全新 iOMC3 服务器配置
请依次执行以下步骤:
配置以太网 IP 地址
[root@iomc3 ~]# vi /etc/sysconfig/networking/ifcfg-eth0
[root@iomc3 ~]# service network restart
[root@iomc3 ~]#
[root@iomc3 ~]# route add default gw 192.168.1.1
[root@iomc3 ~]# echo "nameserver 192.168.1.1" > /etc/resolv.conf
[root@iomc3 ~]# ping baidu.com
升级软件源
[root@iomc3 ~]# yum update
安装 Apache、MySQL、PHP
[root@iomc3 ~]# yum install httpd php mysql mysql-server php-mysql
[root@iomc3 ~]# service httpd start
[root@iomc3 ~]# service mysqld start
管理 MySQL 数据库
[root@iomc3 ~]# who --runlevel
[root@iomc3 ~]# chkconfig --list
[root@iomc3 ~]# chkconfig --level 35 mysqld on
[root@iomc3 ~]# chkconfig --list
[root@iomc3 ~]# mysql -u root
安装 XDebug
[root@iomc3 ~]# yum install php-dev gcc
[root@iomc3 ~]#
[root@iomc3 ~]# yum install wget
[root@iomc3 ~]# wget https://xdebug.org/files/xdebug-2.2.7.tgz
[root@iomc3 ~]#
[root@iomc3 ~]# tar vxzf xdebug-2.2.7.tgz
[root@iomc3 ~]# cd xdebug-2.2.7
[root@iomc3 ~]# phpize
[root@iomc3 ~]# ./configure --enable-xdebug
[root@iomc3 ~]# make
[root@iomc3 ~]# make install
[root@iomc3 ~]#
[root@iomc3 ~]# find / -name xdebug.so
/usr/lib64/php/modules/xdebug.so
[root@iomc3 ~]# vi /etc/php.ini
[xdebug]
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.auto_trace=on
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_host=192.168.1.211
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
[root@iomc3 ~]#
[root@iomc3 ~]# service httpd restart
配置防火墙放行 http、XDebug 访问
[root@iomc3 ~]# vi /etc/sysconfig/iptables
# append these two lines below
-A INPUT -state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT
[root@iomc3 ~]# /etc/init.d/iptables restart
[root@iomc3 ~]# /etc/init.d/iptables status
配置防火墙放行 MySQL 访问
[root@iomc3 ~]# vi /etc/sysconfig/iptables
# append this line below
-A INPUT -state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
[root@iomc3 ~]# /etc/init.d/iptables restart
[root@iomc3 ~]# /etc/init.d/iptables status
配置 SELinux
[root@iomc3 ~]# vi /etc/selinux/config
...
#SELINUX=enforcing
SELINUX=disabled
...
[root@iomc3 ~]# setenforce 0
配置自动更新代码
[root@iomc3 ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
0 0 * * * /usr/bin/git fetch /var/www/html/arn-iomc3/
5 0 * * * /bin/cp -rf /var/www/html/arn-iomc3/iomc3/ /var/www/html/
[root@iomc3 ~]#