1. install CentOS6.2 System 1. select Desktop for installation. note: If the host name is changed, add the configured host name to the/etc/hosts file. 2. ssh security settings (configuration file: /etc/ssh/sshd_config): 1) change the default Port 22: remove the Port comment, such as: 221232) disable root account logon: remove the PermitRootLoginyes comment and change it to PermitRo.
1. install CentOS6.2
1. select Desktop for installation
Note: If you have modified the host name, you need to add the configured host name to the/etc/hosts file.
2. ssh security settings (Configuration File:/etc/ssh/sshd_config ):
1) change the default Port 22: remove the Port comment, for example, 22123.
2) disable root account logon: remove the PermitRootLogin yes annotation and change it to PermitRootLogin no.
3) add an SSH logon user and log on to the root user after successful logon:
- # useradd xiaoma
- # passwd xiaoma
Then modify the ssh configuration file and add: AllowUsers xiaoma.
4) restart the SSH service: service sshd restart
5) change the firewall configuration and allow port 22123 to be added to:-a input-m state? State NEW-m tcp-p tcp? Dport 22123-j ACCEPT, and restart the firewall to take effect: service iptables restart
2. software environment configuration
1. install the compiling environment:
- # yum install gcc gcc-c++
Note: the proxy accesses the internet. command line: export http_proxy = http: // ip: port
2. install necessary libraries
- # yum install ncurses-devel zlib-devel libjpeg* libpng* freetype*
Note: ncurses-devel? Compile and install mysql5.5
Zlib-devel? Compile and install httpd
Libjpeg *, libpng *, freetype *? Compile and install php
3. install clamAV antivirus software
- # tar xzf clamav-0.97.4.tar.gz
- # cd clamav-0.97.4
- # ./configure --prefix=/usr/local/clamav --disable-clamav
- # make
- # make install
- # groupadd clamav
- # useradd -g clamav clamav
- # chown -R clamav.clamav /usr/local/clamav
Operation example:
1) update the virus database: bin/freshclam (you need to modify the etc/freshclam. conf file to comment out the 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. add the following configuration to the/etc/profile file:
- JAVA_HOME=/usr/local/jdk1.6.0_33
- export JAVA_HOME
- export PATH=/usr/local/mysql5/bin:$JAVA_HOME/bin:$PATH
Then update the environment variable to make it take effect:
- # source /etc/profile
View the installed java version:
- # java -version
5. install Mysql5.5 (mysql5.5 requires cmake compilation and cmake installation first)
- # tar xzf cmake-2.8.7.tar.gz
- # cd cmake-2.8.7
- # ./configure
- # make && make install
- # mkdir -p /usr/local/mysql5
- # groupadd 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 as follows:
- # 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
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'
Add Environment variables and add the following to the/etc/profile file:
- export PATH=/usr/local/mysql5/bin:$PATH
Modify the default maximum number of connections of mysql (only 151 by default). open/etc/my. in the cnf file, add max_connections = 1000 under [mysqld], and then restart mysql to take effect. check the maximum number of connections:
- mysql>show VARIABLESLIKE'%conn%';
6. install 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 Port 80 must be enabled for iptables ):
- # /usr/local/apache2/bin/apachectl start
To disable access to a directory, you can create a. htaccess file under the Directory and enter the following content:
- order allow,deny
- deny from all
7. install php
- # 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
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
Restart httpd to make php take effect!
8. install Tomcat 7
- # unzip -q apache-tomcat-7.0.23.zip
- # mv apache-tomcat-7.0.23 tomcat-7
Configure the tomcat virtual host, open the conf/server. xml configuration file, and add the following sections (add multiple sections as follows ):
-
- unpackWARs="true"autoDeploy="true">
- chinapis.com
-
After tomcat is configured, you also need to configure the apache VM File (conf/extra/httpd-vhosts.conf ):
-
- 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 480" common
- ProxyPass /images/ !
- ProxyPass /styles/ !
- ProxyPreserveHost On
- ProxyPass / ajp://localhost:8009/
- ProxyPassReverse / ajp://localhost:8009/
The preceding configurations are described as follows:
1) ErrorLog and CustomLog configure the polling time of log files (86400 indicates that the second is a day, and 480 is the time zone offset)
III. FAQs
1. when compiling and installing php, the following error occurs: configure: error: libpng. (a | so) not found. first, install each dependent component (libjpeg, libpng, and freetype), and then perform the following processing:
- # ln -s /usr/lib64/libjpeg.so /usr/lib/
- # ln -s /usr/lib64/libpng.so /usr/lib/
2, decompress the bin format jdk when the error:/lib/ld-linux.so.2: bad ELF interpreter, need to install some of the missing files:
- # yum install ld-linux.so.2