I. Installation of CentOS6.2 system
1. Select Desktop for installation
Note: If you modify the hostname, you need to add the host name of the setting in the/etc/hosts file
2, SSH security settings (configuration file:/etc/ssh/sshd_config):
1 Change the default 22 port: Remove the comment for port, and change it to such as: 22123
2 prohibit the root account login: Remove permitrootlogin yes annotation, change to: Permitrootlogin No
3 new SSH login user, after the successful login and then su to root:
# useradd xiaoma# passwd Xiaoma then modify the SSH configuration file, and finally add: Allowusers xiaoma
4 Restart SSH Services: Service sshd restart
5 Change the firewall configuration, allow 22123 ports, add: A input-m state–state new-m tcp-p tcp–dport 22123-j, and restart the firewall in effect: Service ACCEPT iptables
Second, the Software environment configuration
1, the installation of the compilation environment:
# yum Install GCC gcc-c++ Note: proxy Internet, command line: Export Http_proxy=http://ip:port
2, the installation of some necessary libraries
# yum Install ncurses-devel zlib-devel libjpeg* libpng* freetype* Note: ncurses-devel– compile install mysql5.5 required
zlib-devel– Compile installation httpd required
libjpeg*, libpng*, freetype*– compile installation PHP required
3, install ClamAV anti-virus software
# tar Xzf clamav-0.97.4.tar.gz# cd clamav-0.97.4#./configure--prefix=/usr/local/clamav--disable-clamav# Make INS Tall # groupadd clamav# useradd-g clamav clamav# chown-r Clamav.clamav/usr/local/clamav
Action Example:
1 Update virus Library: Bin/freshclam (need to modify etc/freshclam.conf file to comment out example line)
2) scan the specified directory: Bin/clamscan–bell-i-r/usr/local
4. Install JDK
# chmod +x jdk-6u33-linux-i586.bin#./jdk-6u33-linux-i586.bin# mv jdk1.6.0_33//usr/local set JDK environment variables,/etc/profile files in the last add Into the following configuration:
Java_home=/usr/local/jdk1.6.0_33export java_homeexport path=/usr/local/mysql5/bin: $JAVA _home/bin: $PATH The environment variable is then updated to take effect:
# Source/etc/profile View the installed Java version:
# java-version5, install Mysql5.5 (mysql5.5 need cmake compile, need to install CMake first)
# tar Xzf cmake-2.8.7.tar.gz# cd cmake-2.8.7#./configure# make && make install # mkdir-p/usr/local/mysql5# g Roupadd mysql# useradd-g mysql mysql# chown mysql.mysql-r/usr/local/mysql5 # tar xzf mysql-5.5.19.tar.gz# cd mysql-5.5. 19/# Cmake-dcmake_install_prefix=/usr/local/mysql5-dmysql_unix_addr=/usr/local/mysql5/mysql.sock-ddefault_ Charset=utf8-ddefault_collation=utf8_general_ci-dwith_extra_charsets=all-dwith_myisam_storage_engine=1-dwith_ Innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-denabled_local_infile=1-dmysql_ datadir=/usr/local/mysql5/data-dmysql_user=mysql-dmysql_tcp_port=3306# make# make install Configure MySQL to do the following:
# CP support-files/my-medium.cnf/etc/my.cnf# chmod 755 scripts/mysql_install_db# scripts/mysql_install_db--user= MySQL--BASEDIR=/USR/LOCAL/MYSQL5--datadir=/usr/local/mysql5/data # cp Support-files/mysql.server/etc/init.d/mysql # chmod 755/etc/init.d/mysql# chkconfig MySQL on to start MySQL and set the root account password:
#/etc/init.d/mysql start or service MySQL start#/usr/local/mysql5/bin/mysqladmin-uroot password ' root ' to add environment variables, in/etc/p Rofile file in the final add:
Export Path=/usr/local/mysql5/bin: $PATH Modify the default maximum number of MySQL connections (default is only 151), open the/etc/my.cnf file, add under [mysqld]: max_connections= 1000, and then restart MySQL to take effect, to see the maximum number of connections:
Mysql>show VARIABLES like '%conn% '; 6, installation httpd
# tar xzf httpd-2.2.21.tar.gz# cd httpd-2.2.21/# cd srclib/apr#./configure--prefix=/usr/local/apr# make# make install # Cd.. /apr-util#./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr# make# make install # CD. /.. #./configure--prefix=/usr/local/apache2--enable-so--enable-mods-shared=all--with-apr=/usr/local/apr-- With-apr-util=/usr/local/apr-util--enable-dav--enable-proxy--enable-proxy-ajp# make# make install start httpd and Access http:/ /IP for testing (note that Iptables needs to open port 80):
#/usr/local/apache2/bin/apachectl Start If you need to disable access to a directory, you can create a new. htaccess file in that directory and enter the following:
Order Allow,denydeny from ALL7, installing PHP
| The code is as follows |
Copy Code |
| # tar Xzf libxml2-2.7.5.tar.gz# cd libxml2-2.7.5#./configure--prefix=/usr/local/libxml2# make# make install # CD. # Rpm-qa php# rpm-e--nodeps--allmatches php-5.1.6-27.el5# tar xzf php-5.3.1.tar.gz# cd php-5.3.1#./configure--prefix =/USR/LOCAL/PHP5--with-libxml-dir=/usr/local/libxml2/--with-mysql=/usr/local/mysql5/--with-apxs2=/usr/local/ Apache2/bin/apxs--with-mbstring--enable-mbstring=all--with-gd# make# make install# CP php.ini-production/usr/local/ Php5/lib/php.ini |
To modify the httpd.conf file:
1) Add a line after AddType application/x-gzip gz. tgz: AddType application/x-httpd-php. php
2) Add index.php after DirectoryIndex index.html
After restarting the httpd, you can make PHP effective!
8. Installation TOMCAT7
# unzip-q apache-tomcat-7.0.23.zip# mv apache-tomcat-7.0.23 tomcat-7 configuration Tomcat Virtual host, open conf/ Server.xml configuration file, add the following paragraph (multiple then add more than the following paragraph can):
| code is as follows |
copy code |
<virtualhost *:80> DocumentRoot "/kington/webapps/chinapis" ServerName www.mzone.cc Serveralias mzone.cc ErrorLog "| /usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/mzone.cc_%y-%m-%d_error_log 86400 480 " Customlog "| /usr/local/apache2/bin/rotatelogs/usr/local/apache2/logs/mzone.cc_%y-%m-%d_access_log 86400 "Common ProxyPass Images/! Proxypass/styles/! Proxypreservehost on proxypass/ajp://localhost:8009/ proxypassreverse/ajp://localhost:8009/ </VirtualHost> |
The instructions in the above configuration are as follows:
1) errorlog and Customlog configured the polling time for the log file (86400 for the second is one day, 480 is the time zone offset)
Third, frequently asked questions
1, compile and install PHP encountered: Configure:error:libpng. (A|SO) not found, first install each dependent component (Libjpeg, libpng, FreeType), and then do the following:
# ln-s/usr/lib64/libjpeg.so/usr/lib/# ln-s/USR/LIB64/LIBPNG.SO/USR/LIB/2, extract the bin format jdk when the error:/lib/ld-linux.so.2:bad ELF interpreter, you need to install some missing files:
# yum Install ld-linux.so.2