centos7配置笔记
原因:前两天服务器的硬盘出故障,报错:scsi 0:0:2:0: rejecting I/O to dead device,报这个错误的时候重启过一次,撑了一个月时间,现在直接导致整个文件系统崩溃。很明显是硬盘出问题了(一直在线用了4年多,而且I/O操作也非常频繁),原来有3块sas硬盘,其中两块500G的作了Raid1,另一块1T是备份并作了LVM,现在很难确定是哪一块有问题,估计寿命也都差不多了,打算直接都换掉算了。
准备:现在备了一块256G固态硬盘用于装centos和一块1T的sas硬盘用作存储数据,并让机房帮忙安装了最小版的centos7,内核: 3.10.0-229.el7.x86_64。
一、网络设置及服务
原来的网络有两块网卡,一个接外网,一个接内网,直接执行ifconfig竟然提示无此命令,原来centos7最小版默认就不用这个了,可以用ip addr 和 ip link代替。而且ifcfg的名字也改为emN这种形式了,直接编辑/etc/sysconfig/network-scripts/ifcfg-em2配置内网ip,配好后执行service network restart,然后ping一下看能否连通其它内网机器。
可以在/lib/systemd/system/目录下创建一些扩展名为.service的服务配置文件,如:nginx.service.
二、安全设置
- 删除不用的用户:adm、lp、sync、shutdown、halt、ftp
- 更改sshd登录端口:
- Port 12345
- #AddressFamily any
- #ListenAddress 0.0.0.0
- #ListenAddress ::
- # The default requires explicit activation of protocol 1
- Protocol 2
然后重启服务(注意: 在重启前请先保证防火墙已经放开了新的端口12345,具体参考下面的防火墙设置)
- systemctl restart sshd.service
安装selinux管理命令:
- semanage port -a -t ssh_port_t -p tcp 12345
查看端口列表
- semanage port -l | grep ssh
- Port 12345
防火墙:默认的已经由iptables转为了firewalld了(http://blog.csdn.net/smstong/article/details/39317277),如果用firewall参考http://blog.sina.com.cn/s/blog_43b39e250102v4zt.html,如果想继续用iptables可以参考http://linux.it.net.cn/CentOS/fast/2015/0110/11567.html
更多安全措施可参考:安装 CentOS 7 后必做的七件事
三、磁盘设置
- 利用LVM增加硬盘及扩容,参考:http://www.centoscn.com/CentOS/config/2015/0315/4891.html;另外,也可以借助系统存储管理器管理LVM卷,参考:http://os.51cto.com/art/201409/450584.htm。
四、支撑环境
- 安装rabbitmq,参考:http://my.oschina.net/jackwanger/blog/207898, 但在使用过程中发现没办法直接通过yum install erlang安装erlang,所以还得通过源码装。如果configure时指定了prefix,安装后还得在/etc/profile export指定path。在安装rabbitmq时提示
- rabbitmq /bin/sh: zip: command not found
表示少了zip
- yum install zip unzip
- cd rabbitmq-server-3.5.3
- make
- make install TARGET_DIR=/usr/local/rabbitmq SBIN_DIR=/usr/local/rabbitmq/sbin MAN_DIR=/usr/local/rabbitmq/man
后台启动
- ./rabbitmq-server -detached
rabbitmq安装后默认端口为5672,而且不需要特定的配置,如果想指定一些特殊配置,可以参考:http://www.rabbitmq.com/configure.html
安装cmake:
- wget http://www.cmake.org/files/v3.3/cmake-3.3.0-rc3.tar.gz
- tar zxf cmake-3.3.0-rc3.tar.gz
- cd cmake-3.3.0-rc3
- ./configure
- make
- make install
- wget http://www.cmake.org/files/v3.3/cmake-3.3.0-rc3.tar.gz
安装mysql
- wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz
- tar zxf mysql-5.6.27.tar.gz
- groupadd mysql
- useradd -g mysql mysql -s /bin/false
- mkdir -p /data/mysql
- chown -R mysql:mysql /data/mysql
- mkdir -p /usr/local/mysql
- cd mysql-5.6.27
- cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc
- make
- make install
- cd /usr/local/mysql
- cp ./support-files/my-huge.cnf /etc/my.cnf
- vi /etc/my.cnf
- datadir = /data/mysql #添加MySQL数据库路径
- ./scripts/mysql_install_db --user=mysql
- cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
- chmod 755 /etc/init.d/mysqld
- chkconfig mysqld on
- vi /etc/rc.d/init.d/mysqld
- basedir = /usr/local/mysql
- datadir = /data/mysql
- service mysqld start
- vi /etc/profile
- export PATH=$PATH:/usr/local/mysql/bin
- ln -s /usr/local/mysql/lib /usr/lib/mysql
- ln -s /usr/local/mysql/include/mysql /usr/include/mysql
- mysql_secure_installation
如果mysql命令行登录时提示:段错误(Segmentation fault),则需要按下面步骤处理:http://www.cnblogs.com/jenqz/p/4892570.html
- wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz
安装pcre
- tar zxvf pcre-8.37.tar.gz
- cd pcre-8.37
- ./configure --prefix=/usr/local/pcre
- make
- make install
- tar zxvf pcre-8.37.tar.gz
- 安装openssl
- wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz
安装nginx
1. yum安装参考:http://www.linuxidc.com/Linux/2014-09/106192.htm2.- yum -y install zlib-devel
源码安装:
- wget http://nginx.org/download/nginx-1.9.5.tar.gz
- tar zxf nginx-1.9.5.tar.gz
- groupadd www
- useradd -g www www -s /bin/false
- cd nginx-1.9.5
- ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/root/tools/pcre-8.36
- make
- make install
3.设置为服务
- cat >> /usr/lib/systemd/system/nginx.service << NGINX_SERVICE
- > [Unit]
- > Description=The nginx HTTP and reverse proxy server
- > After=syslog.target network.target remote-fs.target nss-lookup.target
- >
- > [Service]
- > Type=forking
- > PIDFile=/run/nginx.pid
- > ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
- > ExecReload=/bin/kill -s HUP $MAINPID
- > ExecStop=/bin/kill -s QUIT $MAINPID
- > PrivateTmp=true
- >
- > [Install]
- > WantedBy=multi-user.target
- > NGINX_SERVICE
- systemctl enable nginx
- systemctl start nginx.service
- wget http://nginx.org/download/nginx-1.9.5.tar.gz
安装php
- 1.安装php相关支持库
- yum -y install libxml2 libxml2-devel libcurl-devel freetype freetype-devel libjpeg* libpng libpng-devel gd openssl openssl-devel libmcrypt
- 2.安装php
- ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir --with-freetype-dir
- make
- make install
- ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-jpeg-dir --with-freetype-dir
安装redis
- wget http://download.redis.io/releases/redis-3.0.2.tar.gz
- tar zxvf redis-3.0.2.tar.gz
- cd redis-3.0.2
mkdir /usr/local/redis - make PREFIX=/usr/local/redis install
- wget http://download.redis.io/releases/redis-3.0.2.tar.gz
安装ttserver,同时装一下httpsqs
- wget http://fallabs.com/tokyocabinet/tokyocabinet-1.4.48.tar.gz
- tar zxf tokyocabinet-1.4.48.tar.gz
- cd tokyocabinet-1.4.48
- ./configure --prefix=/usr/local/tokyocabinet-1.4.48/
- make
- make install
- wget http://fallabs.com/tokyotyrant/tokyotyrant-1.1.41.tar.gz
- tar zxf tokyotyrant-1.1.41.tar.gz
- cd tokyotyrant-1.1.41
- ./configure --prefix=/usr/local/tokyotyrant-1.1.41 --with-tc=/usr/local/tokyocabinet-1.4.48/
- wget http://httpsqs.googlecode.com/files/httpsqs-1.7.tar.gz
- tar xzf httpsqs-1.7.tar.gz
- cd httpsqs-1.7
- vi Makefile #将tokyocabinet由1.4.47改为1.4.48
- make
- make install
ttserver的php扩展
- wget http://pecl.php.net/get/tokyo_tyrant-0.7.0.tgz
- tar zxvf tokyo_tyrant-0.7.0.tgz
- cd tokyo_tyrant-0.7.0
- /usr/local/php/bin/phpize
- ./configure --with-php-config=/usr/local/php/bin/php-config --with-tokyo-tyrant=/usr/local/tokyotyrant-1.1.41 --with-tokyo-cabinet-dir=/usr/local/tokyocabinet-1.4.48
- make && make install
- wget http://fallabs.com/tokyocabinet/tokyocabinet-1.4.48.tar.gz
安装sphinx
- wget http://www.sphinx-search.com/downloads/sphinx-for-chinese-2.2.1-dev-r4311.tar.gz
- tar zxf sphinx-for-chinese-2.2.1-dev-r4311.tar.gz
- cd sphinx-for-chinese-2.2.1-dev-r4311
- ./configure --prefix=/usr/local/sphinx --with-mysql
- make
- make install
安装sphinx的php扩展
- cd sphinx-for-chinese-2.2.1-dev-r4311/api/libsphinxclient
- ./configure –prefix=/usr/local/sphinxclient
- make && make install
- wget http://pecl.php.net/get/sphinx-1.3.0.tgz
- tar zxf sphinx-1.3.0.tgz
- cd sphinx-1.3.0
- /usr/local/php/bin/phpize
- ./configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinxclient/
- make
- make install
- wget http://www.sphinx-search.com/downloads/sphinx-for-chinese-2.2.1-dev-r4311.tar.gz
五、应用环境;
centos7配置笔记的更多相关文章
- 新装系统(CentOS7.4)环境初始化配置笔记
新装系统(CentOS7.4)环境初始化配置笔记 一.概述 设备详情: Dell R730 服务器 (四个网卡,一根网线插在第2个网卡上) CentOS 7.4 x64 最小安装环境 二.网络环境配置 ...
- CentOS7 安装配置笔记
CentOS7 安装配置笔记 1.通过镜像安装 CentOS7 ==============================* 使用 UltraISO 9.7 或者 rufus-3.5p 制作ISO的 ...
- CentOS6.5环境配置笔记
CentOS6.5环境配置笔记 一.概述 服务器系统重装,配置应用运行环境 CentOS6.5 x64 二.修改密码 重新设置登录密码 $passwd 或 $passwd root 三.配置端口号及防 ...
- Centos7 配置网络步奏详解
Centos7 配置网络步奏详解 编辑网卡配置文件 vi /etc/sysconfig/network-script/ifcfg-ens01 备注:这里的ens01不是所有系统都叫这个,有的可能叫其他 ...
- Bandwidthd+Postgresql数据库配置笔记
Bandwidthd+Postgresql数据库配置笔记 本系列文章由ex_net(张建波)编写,转载请注明出处. http://blog.csdn.net/zjianbo/article/detai ...
- centos7配置开启无线网卡,重启防火墙
centos7配置无线网卡: 在虚拟机为nat的网络连接下(就是默认的那个),centos7默认网卡未激活. 可以设置 文件 /etc/sysconfig/network-scripts/ifcfg- ...
- 软件安装配置笔记(三)——ArcGIS系列产品安装与配置(补档)(附数据库连接及数据导入)
在前两篇安装配置笔记之后,就忘记把其他安装配置笔记迁移过来了,真是失误失误!趁现在其他文档需要赶紧补上. 目录: 一.ArcMap 二.ArcMap连接数据库并导入数据 三.Arcgis Pro 四. ...
- linux文件权限目录配置笔记
###linux 文件权限目录配置笔记 ---------- 多人多任务环境 linux 一般将文件可存取的身份分为三个类别:owner group others Permission deny ls ...
- Centos7配置JAVA_HOME
Centos7配置JAVA_HOME http://blog.csdn.net/zzpzheng/article/details/73613838 在Centos7上,通过yum install ja ...
随机推荐
- backtrack下whatweb的使用
whatweb是backtrack下的一款Web识别工具,位于 Applications-->BackTrack-->Information Gathing-->Web Applic ...
- windows 10安装framework 3.5失败的解决方案
装了两次win 10,全都因为没法安装framework 3.5,用不了老版本的开发环境,又换回了win7. 网上有两种解决方案: a,通过iso安装. 可是拜托,我的系统都是用ghost版本安装的, ...
- kuangbin_UnionFind C (HDU 1213)
过程模板 扫一下一共有几棵树 输出 #include <iostream> #include <string> #include <cstdio> #include ...
- java多线程之:创建开启一个线程的开销
---->关于时间,创建线程使用是直接向系统申请资源的,这里调用系统函数进行分配资源的话耗时不好说.---->关于资源,Java线程的线程栈所占用的内存是在Java堆外的,所以是不受jav ...
- IntelliJ IDEA 开发前的设置
1.IntelliJ IDEA 显示行号方法 设置方法:File->Settings->Editor->General->Appearance->Show line nu ...
- 论文阅读之:PRIORITIZED EXPERIENCE REPLAY
PRIORITIZED EXPERIENCE REPLAY ICLR 2016 经验回放使得 online reinforcement learning agent 能够记住并且回放过去的经验.在先前 ...
- C# 正则表达式类 Match类和Group类
@"\b(\S+)://(\S+)\b"; //匹配URL的模式foreach (Match match in mc){ Console.WriteLine(match.Value ...
- 转 -Linux 自检和 SystemTap (强大的内核调试工具)---包含下载地址
下载: http://www.oschina.net/p/systemtap/ https://sourceware.org/systemtap/ftp/releases/ Linux 自检和 S ...
- js button onclick动作赋值操作
昨天遇到的小问题 记录下 主要的东西其实都在这里:http://www.jb51.net/article/35107.htm 我稍微写一下: <script> function show( ...
- 对OCR文字识别软件的扫描选项怎么设置
说到OCR文字识别软件,越来越多的人选择使用ABBYY FineReader识别和转换文档,然而并不是每个人都知道转换质量取决于源图像的质量和所选的扫描选项,今天就给大家普及一下这方面的知识. ABB ...