CentOS6.2 system basic software environment Configuration tutorial

Source: Internet
Author: User
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:

 
 
  1. # useradd xiaoma
  2. # 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:

 
 
  1. # yum install gcc gcc-c++

Note: the proxy accesses the internet. command line: export http_proxy = http: // ip: port

2. install necessary libraries

 
 
  1. # 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

 
 
  1. # tar xzf clamav-0.97.4.tar.gz
  2. # cd clamav-0.97.4
  3. # ./configure --prefix=/usr/local/clamav --disable-clamav
  4. # make
  5. # make install
  6. # groupadd clamav
  7. # useradd -g clamav clamav
  8. # 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

 
 
  1. # chmod +x jdk-6u33-linux-i586.bin
  2. # ./jdk-6u33-linux-i586.bin
  3. # mv jdk1.6.0_33/ /usr/local

Set JDK environment variables. add the following configuration to the/etc/profile file:

 
 
  1. JAVA_HOME=/usr/local/jdk1.6.0_33
  2. export JAVA_HOME
  3. export PATH=/usr/local/mysql5/bin:$JAVA_HOME/bin:$PATH

Then update the environment variable to make it take effect:

 
 
  1. # source /etc/profile

View the installed java version:

 
 
  1. # java -version

5. install Mysql5.5 (mysql5.5 requires cmake compilation and cmake installation first)

 
 
  1. # tar xzf cmake-2.8.7.tar.gz
  2. # cd cmake-2.8.7
  3. # ./configure
  4. # make && make install
  5. # mkdir -p /usr/local/mysql5
  6. # groupadd mysql
  7. # useradd -g mysql mysql
  8. # chown mysql.mysql -R /usr/local/mysql5
  9. # tar xzf mysql-5.5.19.tar.gz
  10. # cd mysql-5.5.19/
  11. # 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
  12. # make
  13. # make install

Configure Mysql as follows:

 
 
  1. # cp support-files/my-medium.cnf /etc/my.cnf
  2. # chmod 755 scripts/mysql_install_db
  3. # scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql5 --datadir=/usr/local/mysql5/data
  4. # cp support-files/mysql.server /etc/init.d/mysql
  5. # chmod 755 /etc/init.d/mysql
  6. # chkconfig mysql on

Start mysql and set the root account password:

 
 
  1. #/Etc/init. d/mysql start or service mysql start
  2. #/Usr/local/mysql5/bin/mysqladmin-uroot password 'root'

Add Environment variables and add the following to the/etc/profile file:

 
 
  1. 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:

 
 
  1. mysql>show VARIABLESLIKE'%conn%';

6. install httpd

 
 
  1. # tar xzf httpd-2.2.21.tar.gz
  2. # cd httpd-2.2.21/
  3. # cd srclib/apr
  4. # ./configure --prefix=/usr/local/apr
  5. # make
  6. # make install
  7. # cd ../apr-util
  8. # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
  9. # make
  10. # make install
  11. # cd ../..
  12. # ./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
  13. # make
  14. # make install

Start httpd and access http: // ip for testing (note that Port 80 must be enabled for iptables ):

 
 
  1. # /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:

 
 
  1. order allow,deny
  2. deny from all

7. install php

 
 
  1. # tar xzf libxml2-2.7.5.tar.gz
  2. # cd libxml2-2.7.5
  3. # ./configure --prefix=/usr/local/libxml2
  4. # make
  5. # make install
  6. # cd ..
  7. # rpm -qa php
  8. # rpm -e --nodeps --allmatches php-5.1.6-27.el5
  9. # tar xzf php-5.3.1.tar.gz
  10. # cd php-5.3.1
  11. # ./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
  12. # make
  13. # make install
  14. # 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

 
 
  1. # unzip -q apache-tomcat-7.0.23.zip
  2. # 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 ):

 
 
  1. unpackWARs="true"autoDeploy="true">
  2. chinapis.com

After tomcat is configured, you also need to configure the apache VM File (conf/extra/httpd-vhosts.conf ):

 
 
  1.    DocumentRoot "/kington/webapps/chinapis"
  2.    ServerName www.mzone.cc
  3.    ServerAlias mzone.cc
  4.    ErrorLog "| /usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/mzone.cc_%Y-%m-%d_error_log 86400 480"
  5.    CustomLog "| /usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/mzone.cc_%Y-%m-%d_access_log 86400 480" common
  6.    ProxyPass /images/ !
  7.    ProxyPass /styles/ !
  8.    ProxyPreserveHost On
  9.    ProxyPass / ajp://localhost:8009/
  10.    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:

 
 
  1. # ln -s /usr/lib64/libjpeg.so /usr/lib/
  2. # 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:

 
 
  1. # yum install ld-linux.so.2


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.