环境:RHEL 6.6
首先安装好RHEL6.6,并将RHEL6.6的iso文件作为本地YUM源。
1. 设置防火墙,开启mysql port:3306 apache port:80
# vim /etc/sysconfig/iptables
修改后的文件内容如下:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
2. disable SELinux
# vim /etc/selinux/config
修改后的文件内容如下:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
3. 安装Apache httpd 服务
(1)# rpm -qa|grep httpd
(2)# yum install httpd -y
(3)# vim /etc/httpd/conf/httpd.conf
修改 276行,内容如下:
ServerName localhost
(4)# chkconfig --level 35 httpd on
(5)# /etc/init.d/httpd restart
4. 安装MySQL服务
(1)# yum install mysql mysql-server -y
(2)# /etc/init.d/mysqld start
(3)# chkconfig --level 35 mysqld on
(4)拷贝配置文件、设置MySQL的root账户密码(该root非Linux账户root)
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
5. 安装PHP
(1)#yum install php php-mysql -y
(2)# vim /var/www/html/index.php
内容如下:
<?php
phpinfo();
?>
(3)# /etc/init.d/httpd restart
6. 访问http://localhost
参考文献:
1. http://www.it165.net/admin/html/201401/2302.html
2. http://wenku.baidu.com/link?url=Aq-nzbul5b84FGL290LIHyQjaL4UZT-md4OfOLp2sQU2fWMNhDK6JXCjtlJtLXg3KpCddTnsGptmvDmyQut6qckAqK97zAkfwQ-SprVIWl
3. http://zhidao.baidu.com/link?url=FrRo3m3aUHsCn5TX0SZI9ZLM6pEVpdWxFExE_NBGpOkEP-tPWdIqBlZqhXCIM6nfgdatH5kluyBtaxgtRw10LOyN3ffuw0rLci4Ki2gq7re
首先安装好RHEL6.6,并将RHEL6.6的iso文件作为本地YUM源。
1. 设置防火墙,开启mysql port:3306 apache port:80
# vim /etc/sysconfig/iptables
修改后的文件内容如下:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
2. disable SELinux
# vim /etc/selinux/config
修改后的文件内容如下:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
3. 安装Apache httpd 服务
(1)# rpm -qa|grep httpd
(2)# yum install httpd -y
(3)# vim /etc/httpd/conf/httpd.conf
修改 276行,内容如下:
ServerName localhost
(4)# chkconfig --level 35 httpd on
(5)# /etc/init.d/httpd restart
4. 安装MySQL服务
(1)# yum install mysql mysql-server -y
(2)# /etc/init.d/mysqld start
(3)# chkconfig --level 35 mysqld on
(4)拷贝配置文件、设置MySQL的root账户密码(该root非Linux账户root)
# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
5. 安装PHP
(1)#yum install php php-mysql -y
(2)# vim /var/www/html/index.php
内容如下:
<?php
phpinfo();
?>
(3)# /etc/init.d/httpd restart
6. 访问http://localhost
参考文献:
1. http://www.it165.net/admin/html/201401/2302.html
2. http://wenku.baidu.com/link?url=Aq-nzbul5b84FGL290LIHyQjaL4UZT-md4OfOLp2sQU2fWMNhDK6JXCjtlJtLXg3KpCddTnsGptmvDmyQut6qckAqK97zAkfwQ-SprVIWl
3. http://zhidao.baidu.com/link?url=FrRo3m3aUHsCn5TX0SZI9ZLM6pEVpdWxFExE_NBGpOkEP-tPWdIqBlZqhXCIM6nfgdatH5kluyBtaxgtRw10LOyN3ffuw0rLci4Ki2gq7re
没有评论:
发表评论