1, configure the firewall, open 80 ports, 3306 ports
Vi/etc/sysconfig/iptables
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 3306-j ACCEPT
The firewall configuration file after adding the rules is shown in the following illustration:
/etc/init.d/iptables Restart #重启防火墙使配置生效
2. Close SELinux
Vi/etc/selinux/config
#SELINUXTYPE =targeted #注释掉
3. Add third party yum source
CentOS default yum source software version is too low, to install the latest version of Lamp, where the use of Third-party yum source
wget http://www.atomicorp.com/installers/atomic #下载, first install the wget command using the default yum source yum install wget
Yum Makecache #缓存yum源中的软件包信息
Yum Repolist #列出yum源中可用的软件包
Installation article:
First, install Apache
Yum Install httpd #根据提示, enter y installation to install successfully
/ETC/INIT.D/HTTPD Start #启动Apache
Note: Apache prompts for errors after startup:
Httpd:httpd:Could not reliably determine the server's fully Qualif domain name using:: 1 for ServerName
Vi/etc/httpd/conf/httpd.conf #编辑
ServerName www.example.com:80 #去掉前面的注释
Chkconfig httpd on #设为开机启动
/ETC/INIT.D/HTTPD Restart #重启Apache
When you open the server IP address in the browser, you will see the following interface to indicate that the installation was successful.
Second, the installation of MySQL
1, install MySQL
Yum install MySQL mysql-server #询问是否要安装, enter Y to install automatically until the installation is complete
System Yun-wei www.osyunwei.com warm reminder: qihang01 original Content © Copyright, reproduced please specify the source and the original link
/etc/init.d/mysqld Start #启动MySQL
Chkconfig mysqld on #设为开机启动
CP/USR/SHARE/MYSQL/MY-MEDIUM.CNF/ETC/MY.CNF #拷贝配置文件 (Note: If the/etc directory has a my.cnf under the default, direct coverage can be)
/etc/init.d/mysqld Start #启动
2. Set password for root account
Mysql_secure_installation
Carriage return, enter y according to the prompt
Enter 2 times password, return
Follow the prompts to enter Y
Last seen: the for using mysql!
MySQL password settings complete, restart MySQL:
/etc/init.d/mysqld Stop #停止
/etc/init.d/mysqld Restart #重启
Third, the installation of PHP
1. Install PHP
Yum Install PHP #根据提示输入Y直到安装完成
2, the installation of PHP components, so that PHP support MySQL
Yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-b Cmath Php-mhash Libmcrypt
Here Select the above installation package for installation
Enter Y return according to the prompts
/etc/init.d/mysqld Restart #重启MySql
/ETC/INIT.D/HTTPD Restart #重启Apche
Configuration Chapter
First, Apache configuration
Vi/etc/httpd/conf/httpd.conf #编辑文件
Servertokens OS #修改为: Servertokens Prod (does not display the name of the server's operating system when the error page appears)
Serversignature on #修改为: Serversignature off (version of Apache is not shown in the error page)
Options Indexes followsymlinks #修改为: Options Includes execcgi followsymlinks (allows the server to execute CGI and SSI, disable listing of directories)
#AddHandler cgi-script. CGI #修改为: AddHandler cgi-script. PL (CGI script that allows the extension. pl to run)
AllowOverride None #修改为: allowoverride All (Allow. htaccess)
Adddefaultcharset UTF-8 #修改为: Adddefaultcharset GB2312 (add GB2312 to default encoding)
Options Indexes multiviews followsymlinks #修改为 options MultiViews followsymlinks (does not display the tree directory structure on the browser)
DirectoryIndex index.html index.html.var #修改为: DirectoryIndex index.html index.htm default.html default.htm
index.php default.php Index.html.var #设置默认首页文件, increased index.php
KeepAlive off #修改为: KeepAlive on (allow program online)
Maxkeepaliverequests #修改为: Maxkeepaliverequests 1000 (Increased number of simultaneous connections)
/ETC/INIT.D/HTTPD Restart #重启
Rm-f/etc/httpd/conf.d/welcome.conf/var/www/error/noindex.html #删除默认测试页
Second, PHP configuration
Vi/etc/php.ini #编辑
Date.timezone = PRC #把前面的分号去掉, change to Date.timezone = PRC
Disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_ Alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server, Escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space, POSIX_CTERMID,POSIX_GET_LAST_ERROR,POSIX_GETCWD, Posix_getegid,posix_geteuid,posix_getgid, Posix_getgrgid,posix_ Getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, Posix_getppid,posix_getpwnam, Posix_getpwuid, Posix_getrlimit, Posix_getsid,posix_getuid,posix_isatty, Posix_kill,posix_mkfifo,posix_setegid, Posix_seteuid,posix_setgid, Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname, Posix_uname
#列出PHP可以禁用的函数, if some programs need to use this function, you can remove it and disable it.
expose_php = Off #禁止显示php版本的信息
Short_open_tag = on #在229行支持php短标签
Open_basedir =.:/ tmp/#在380行 settings that allow access to the current directory (that is, the directory where the php script files) and the/tmp/directory, you can prevent the PHP trojan across the station, if there is a problem with the installer (for example, a Dream Content management system), you can log off this line, or directly write the directory of the www.osyunwei.com/:/tmp/
/etc/init.d/mysqld Restart #重启MySql
/ETC/INIT.D/HTTPD Restart #重启Apche
Test article
Cd/var/www/html
Enter the server IP address in the client browser and see the relevant configuration information as shown in the following figure!
NOTE: The Apache default program directory is/var/www/html
Permission settings: Chown apache.apache-r/var/www/html