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 ...
随机推荐
- typedef 和 define的区别
类型取别名,还可以定义常量.变量.编译开关 都知道两个在某些情况下是相同的 但是define是在预编译时就会处理掉,进行简单的宏替换,不管正不正确都替换掉,末尾没有分号,有分号连分号也一起替换了. 而 ...
- Python爬虫学习笔记——防豆瓣反爬虫
开始慢慢测试爬虫以后会发现IP老被封,原因应该就是单位时间里面访问次数过多,虽然最简单的方法就是降低访问频率,但是又不想降低访问频率怎么办呢?查了一下最简单的方法就是使用转轮代理IP,网上找了一些方法 ...
- ExtJS4.2.1自定义主题(theme)样式详解
(基于Ext JS 4.2.1版本) UI组件 学习ExtJS就是学习组件的使用.ExtJS4对框架进行了重构,其中最重要的就是形成了一个结构及层次分明的组件体系,由这些组件形成了Ext的控件. Ex ...
- HTML中特殊字符和与之对应的ASCII代码
ASCII代码是说明了在html中每个特殊字符的属性以及字符的简要说明.在使用html时,如何把ASCII代码添加到网页中.例如版权符号'©'在html中可以通过 "©"来显示. ...
- springMvc源码学习之:利用springMVC随时随地获取HttpServletRequest等对象
一.准备工作: 在web.xml中添加 <listener> <listener-class> org.springframework.web.context.request. ...
- EXT2 文件系统
转自:http://www.cnblogs.com/ggjucheng/archive/2012/08/22/2651641.html#ext2_filesystem 认识ext文件系统 硬盘组成与分 ...
- Textarea高度随内容自适应地增长,无滚动条
<HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; char ...
- CSS3盒模型之box-sizing
这些天在做一个手机端的页面,遇到了一些问题!首当其冲的就是盒子的溢出问题!大家都知道,手机的尺寸各异,各种型号的手机多得能闪瞎你们的眼睛,为了能 让这些设置更好的浏览我们的页面,我们已经不能固定页面的 ...
- 008. asp.net mvc3.0安装文件及其安装时发生错误的解决方案
0. 安装步骤: vs2010 → vs2010sp1→ AspNetMVC3Setup.exe→ AspNetMVC3Setup_CHS.exe→ AspNetMVC3ToolsUpdateSetu ...
- shell流程控制语句
linux shell有一套自己的流程控制语句,其中包括条件语句(if),循环语句(for,while,until),选择语句(case/select).下面我将通过例子介绍下,各个语句使用方法. 1 ...