Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS6.2 system installation and basic software environment configuration process

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the "CentOS6.2 system installation and basic software environment configuration process" related knowledge, in the actual case operation process, many people will encounter such a dilemma, then let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!

First, install CentOS6.2 system

1. Select Desktop to install

Note: if you modify the hostname, you need to add the set hostname in the / etc/hosts file

2. Ssh security settings (configuration file: / etc/ssh/sshd_config):

1) change the default port 22: remove the comments from Port and change it to: 22123

2) disable login of root account: remove the PermitRootLogin yes comment and change it to: PermitRootLogin no

3) add SSH login users, and then su to root after successful login:

The code is as follows:

# useradd xiaoma

# passwd xiaoma

Then modify the ssh configuration file, and finally add: AllowUsers xiaoma

4) restart SSH service: service sshd restart

5) change the firewall configuration to allow port 22123, add: an INPUT-m state-state NEW-m tcp-p tcp-dport 22123-j ACCEPT, and restart the firewall to take effect: service iptables restart

II. Software environment configuration

1. Install the compilation environment:

The code is as follows:

# yum install gcc gcc-c++

Note: agent surfing the Internet, command line: export http_proxy= http://ip:port

2. Install some necessary libraries

The code is as follows:

# yum install ncurses-devel zlib-devel libjpeg* libpng* freetype*

Note: ncurses-devel-required to compile and install mysql5.5

Zlib-devel-compiling and installing httpd is required

Libjpeg*, libpng*, freetype*-compiling and installing php is required

3. Install clamAV antivirus software

The code is as follows:

# 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

Example of operation:

1) Update the virus database: bin/freshclam (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

The code is as follows:

# chmod + x jdk-6u33-linux-i586.bin

#. / jdk-6u33-linux-i586.bin

# mv jdk1.6.0_33/ / usr/local

Set the JDK environment variable, and finally add the following configuration to the / etc/profile file:

The code is as follows:

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 take effect:

The code is as follows:

# source / etc/profile

View the installed version of java:

The code is as follows:

# java-version

5. Install Mysql5.5 (mysql5.5 needs to be compiled by cmake, and cmake needs to be installed first)

The code is as follows:

# 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

To configure Mysql, do the following:

The code is 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:

The code is as follows:

# / etc/init.d/mysql start or service mysql start

# / usr/local/mysql5/bin/mysqladmin-uroot password 'root'

Add the environment variable, and finally in the / etc/profile file:

The code is as follows:

Export PATH=/usr/local/mysql5/bin:$PATH

Modify the default maximum number of mysql connections (default is only 151s), open the / etc/my.cnf file, add: max_connections=1000 under [mysqld], and then restart mysql to take effect. Check the maximum number of connections:

The code is as follows:

Mysql > show VARIABLES LIKE'% conn%'

6. Install httpd

The code is as follows:

# 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):

The code is as follows:

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

The code is as follows:

Order allow,deny

Deny from all

7. Install php

The code is as follows:

# 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 effective!

8. Install Tomcat7

The code is as follows:

# unzip-Q apache-tomcat-7.0.23.zip

# mv apache-tomcat-7.0.23 tomcat-7

Configure the virtual host of tomcat, open the conf/server.xml configuration file, and add the following paragraph (for more than one, you can add more than one of the following paragraphs):

The code is as follows:

Chinapis.com

After configuring tomcat, you also need to configure the virtual host file (conf/extra/httpd-vhosts.conf) for apache:

The code is as follows:

DocumentRoot "/ kington/webapps/chinapis"

ServerName www.yisu.com

ServerAlias jb51.net

ErrorLog "| / usr/local/apache2/bin/rotatelogs / usr/local/apache2/logs/jb51.net_%Y-%m-%d_error_log 86400"

CustomLog "| / usr/local/apache2/bin/rotatelogs / usr/local/apache2/logs/jb51.net_%Y-%m-%d_access_log 86400" common

ProxyPass / images/!

ProxyPass / styles/!

ProxyPreserveHost On

ProxyPass / ajp://localhost:8009/

ProxyPassReverse / ajp://localhost:8009/

The instructions in the above configuration are as follows:

1) ErrorLog and CustomLog configure the polling time for log files (86400 is a day, and 480 is the offset of the time zone)

III. Frequently asked questions

1. When compiling and installing php, you encounter: configure: error: libpng. (a | so) not found. Install the dependent components (libjpeg, libpng, freetype) first, and then do the following:

The code is as follows:

# ln-s / usr/lib64/libjpeg.so / usr/lib/

# ln-s / usr/lib64/libpng.so / usr/lib/

2. An error occurred when decompressing jdk in bin format: / lib/ld-linux.so.2: bad ELF interpreter. Some missing files need to be installed:

The code is as follows:

# yum install ld-linux.so.2

This is the end of the "CentOS6.2 system installation and basic software environment configuration process". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report