1. 开启防火墙端口:
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 22822 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 2121 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart
查看防火墙信息:
/etc/init.d/iptables status
2. 更新yum
yum update
3. 安全设置
useradd bevin
passwd bevin
vi /etc/ssh/sshd_config
#Port22 改成 Port 22822
#PermitRootLogin 改成 PermitRootLogin no
关闭打印服务
/etc/rc.d/init.d/cups stop
chkconfig cups off
4. 安装Apache php
yum -y install httpd
yum -y install php
mkdir /data/webroot/
mkdir /data/log/
vi /etc/httpd/conf/httpd.conf
chkconfig httpd on
chkconfig --list httpd
/etc/rc.d/init.d/httpd start
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
/etc/rc.d/init.d/httpd restart
5. 安装Mysql
yum -y install mysql-server
yum -y install php-mysql
vi /etc/my.cnf
############ my.cnf ############
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
user=mysql
old_passwords=1
default-character-set=utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
default-character-set=utf8
################################
chkconfig mysqld on
chkconfig --list mysqld
/usr/bin/mysql_install_db --datadir=/data/mysql
/etc/rc.d/init.d/mysqld start
mysql
GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO " IDENTIFIED BY 'password' WITH GRANT OPTION;
6. 安装vsftpd
yum install vsftpd
service vsftpd start
chkconfig vsftpd on
vi /etc/vsftpd/vsftpd.conf
groupadd vsftp
useradd -G vsftp –d /data/webroot –M testtest -s /sbin/nologin
安装完成!
如果chkconfig,groupadd不能使用
#bash: chkconfig: command not found
rpm -aq |grep chkconfig
export PATH=/sbin:$PATH
chkconfig
export PATH=/usr/sbin:$PATH
groupadd 在 /usr/sbin/groupadd
如果ftp登陆里显示 类型的错误 500 OOPS: cannot change directory:/data/webroot
setsebool ftpd_disable_trans 1
service vsftpd restart