Configuring the CentOS Server

Source: Internet
Author: User
Tags mcrypt snmp domain name server centos server nameserver

Install the program under the CentOS system that already has the system installed, configure.

Programs to install: Apache2, PHP, JDK

1. #iptables开放固定ip访问

? iptables-i input-s 218.5.81.0/24-p TCP--dport 22-j ACCEPT

? iptables-i input-p TCP--dport 80-j ACCEPT

2, the domain name server configuration is this file/etc/resolv.conf (Configure the Domain name server, can directly download, resolve the domain name)

Add nameserver 8.8.8.8 and nameserver 8.8.4.4
Search Localdomain
NameServer 8.8.8.8
NameServer 8.8.4.4

3. Manually install Apache (httpd) to install the required libraries for Apache compilation

(1) apr:http://apr.apache.org/download.cgi (download good in Windows)

[Email protected]:/work/soft/apache]# tar-xzf apr-1.5.1.tar.gz

[Email protected] @ubuntu:/work/soft/apache/apr-1.5.0]#./configure--prefix=/usr/local/apache2/apr (Specify installation path)

[Email protected] @ubuntu:/work/soft/apache/apr-1.5.0]# make

[[Email protected] @ubuntu:/work/soft/apache/apr-1.5.0]# make Install

(2) Apr-util

apr-util:http://apr.apache.org/download.cgi

[Email protected]:/work/soft/apache]# tar jxvf apr-util-1.5.3.tar.bz2

[Email protected] @ubuntu:/work/soft/apache/apr-util-1.5.3]#/configure--prefix=/usr/local/apache2/apr-util-- WITH-APR=/USR/LOCAL/APACHE2/APR (Specify installation path, Apr-util installation depends on APR, equivalent to using Apr library file)

[Email protected] @ubuntu:/work/soft/apache/apr-util-1.5.3]# make

[[Email protected] @ubuntu:/work/soft/apache/apr-util-1.5.3]# make Install

(3) Pcre

pcre:http://pcre.org/

[Email protected]:/work/soft/apache]# tar jxvf pcre-8.35.tar.bz2

[Email protected] @ubuntu:/work/soft/apache/pcre-8.35]#/configure--prefix=/usr/local/apache2/pcre

[Email protected] @ubuntu:/work/soft/apache/pcre-8.35]# make

[[Email protected] @ubuntu:/work/soft/apache/pcre-8.35]# make Install

Note: If you encounter problems when you install Pcre: Configure:error:You need a C + + compiler for C + + support.

Workaround: sudo apt-get install build-essential or sudo yum install gcc-c++.x86_64

(4) Installation apache:http://httpd.apache.org/

[Email protected]:/work/soft/apache]# tar jxvf httpd-2.4.9.tar.bz2

[Email protected] @ubuntu:/work/soft/apache/httpd-2.4.9]#/configure--prefix=/usr/local/apache2--with-apr=/usr/ LOCAL/APACHE2/APR--with-apr-util=/usr/local/apache2/apr-util--with-pcre=/usr/local/apache2/pcre

[Email protected] @ubuntu:/work/soft/apache/httpd-2.4.9]# make

[[Email protected] @ubuntu:/work/soft/apache/httpd-2.4.9]# make Install

When starting Apache encountered mod_dir.so error, can be installed with Yum Apr-devel and Apr-util-devel

Refer to the following article http://www.th7.cn/system/lin/201305/39347.shtml

(5) See if Apache installs: Apachectl-v

4. Install PHP

Installing Php:http://php.net

Extract

Enter the source code./configure--PREFIX=/USR/LOCAL/PHP5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/ LOCAL/PHP5/ETC \--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir \--with-png-dir-- With-jpeg-dir--with-freetype-dir--with-pear--with-gettext \--with-gmp--enable-inline-optimization--enable-soap- -ENABLE-FTP \--enable-sockets--enable-xml--enable-mbstring--enable-fpm--with-fpm-user=niginx \--with-fpm-group= Nginx--with-libdir=lib64--with-mcrypt--with-mhash \--with-bz2--enable-maintainer-zts

When configured, some packages cannot be found, and Yum installs the make made install

PHP Installation

Error handling

Error:jpeglib.h not found

GD Library is not installed

Solutions

Yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_ 64-y

Error:mcrypt.h not found. Please reinstall Libmcrypt

Solutions

Yum Install Libmcrypt-devel

Configure:error:Could not find Net-snmp-config binary. Please check your NET-SNMP installation.

Workaround: Yum Install Net-snmp-devel

Reference: http://www.linuxidc.com/Linux/2014-05/102327.htm



5. Installing the JDK

First step: Check if the Linux-brought JDK is installed (uninstall CentOS installed 1.4)

The installed CentOS will bring openjdk, with the command java-version, will have the following information:

Java version "1.6.0" OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK 64-bit Server VM (build 1.6.0-b09, Mixed mode)

It is best to uninstall the OPENJDK before installing Sun's JDK.

See Rpm-qa First | grep java

The following information is displayed:

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 Java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

Unloading:

Rpm-e--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 rpm-e--nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

There are some other commands.

Rpm-qa | grep GCJ

Rpm-qa | grep JDK

If OpenJDK source cannot be found, you can also uninstall this

Yum-y Remove Java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 yum-y remove Java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5

<1># rpm-qa|grep jdk← View JDK information or execute directly or # rpm-q JDK or # java-version < 2># Rpm-qa | grep gcj← Confirm GCJ Version number <3># yum-y remove java-1.4.2-gcj-compat← Uninstall GCJ


< 1> download from Sun jdk-7u67-linux-x64.rpm
Create a new Java folder under/usr and place the installation package in the/usr/java directory
# Mkdir/usr/java
< 2> Installing the JDK
# Cd/usr/java
# RPM-IVH jdk-1_5_0_14-linux-i586.rpm← Select Yes until installation is complete

After installation, view the JDK version:

# Rpm-qa | grep JDK

Step Three: Configure environment variables (environment variables not configured)
<1># Vi/etc/profile
< 2> Add the following lines at the end:
Export JAVA_HOME=/USR/JAVA/JDK1.6.0_10
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $PATH: $JAVA _home/bin
< 3># reboot← Restart machine configuration effective

6, solve the ghost loophole: reference http://bobao.360.cn/news/detail/1166.html

Remediation Scenarios

Upgrading the GLIBC Library

Rhel/centos:sudo Yum Update glibc

Configuring the CentOS Server

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.