CentOS is a free, stable Linux version of Red Hat, and the minimal version is used in enterprise server applications because minimal is the "purest" server system on CentOS, because the minimal version even the Vim editor needs to install itself Minimal components are minimal, desktop-free, scalable, and ideal for servers.
1. Configure the NIC
After the minimal version of CentOS is installed, the NIC driver is down by default and needs to be activated manually to execute the command after connecting the network cable:
[Email protected] soft]# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Then press I to enter the edit state and make the following changes:
When you have finished modifying, press ESC, and then SHIFT+:,WQ to save the exit.
Then start configuring the DNS server address:
[Email protected] soft]# vi/etc/resolv.conf
The main thing is to configure the NameServer property, which can be your own gateway address, as shown in:
Save the exit after the modification is complete. Type the following command to activate the network card:
[Email protected] soft]# ifconfig eth0 up
At this point, the network card has been configured, if you still find the power card is not started and other issues, you can perform the following two commands to perfect.
[Email protected] soft]# Chkconfig–add Network
[Email protected] soft]# Chkconfig Network on
To restart the NIC command:
2. Configure firewall, open 3306 (SSH), 11211 (Memcached), 6379 (Redis) port
[Email protected] soft]# Vi/etc/sysconfig/iptables
Modified to:
Restart the firewall for the configuration to take effect:
[Email protected] soft]#/etc/init.d/iptables restart
3. Installing components
Update system:
[[email protected] soft]# Yum update
Type y later to confirm.
Install Vim:
[email protected] soft]# Yum install vim
Install the build tools and dependencies:
[email protected] soft]# yum install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel OpenSSL openssl-devel Pcre-devel gd kernel keyutils patch perl kernel-headers compat* MPFR cpp glibc libgomp libstdc++-devel ppl cloog-ppl Keyut Ils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* Php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch
4. Download cmake,mysql,php,nginx,libevent,libmcrypt,pcre,memcached
If you find these very difficult, recommend to everyone a few good source address:
Ali: http://mirrors.aliyun.com/
Sohu: http://mirrors.sohu.com/
NetEase: http://mirrors.163.com/
I was in the Sohu download, the version is as follows:
5. System conventions
Software source code Package storage location:/USR/LOCAL/SRC
Source Package Compilation Installation location:/usr/local/software Name
Source stacking in the/USR/LOCAL/SRC implementation of a variety of options, can be downloaded in Windows, and then transferred through XFTP to the specified directory, you can also CD to the specified directory, wget; To download.
6. Formal compilation and installation
Install MySQL:
MySQL needs cmake to compile and install, so you must install CMake before installing MySQL
Decompression CMake:
[Email protected] src]# tar xzvf cmake-3.1.1.tar.gz
Enter CMake after extracting directory:
[Email protected] src]# CD cmake-3.1.1
precompilation, this process may take some time:
[Email protected] cmake-3.1.1]#./configure
Compile and install:
[[email protected] cmake-3.1.1]# make && make install
Add MySQL Group
[[email protected] cmake-3.1.1]# Groupadd MySQL
Create user MySQL and join to MySQL group, do not allow MySQL users to log in directly to the system
[Email protected] cmake-3.1.1]# useradd-g MySQL mysql-s/bin/false
Create a MySQL database storage directory
[Email protected] cmake-3.1.1]# mkdir-p/data/mysql
Set the MySQL database to store directory permissions
[Email protected] cmake-3.1.1]# chown-r mysql:mysql/data/mysql
Create MySQL installation directory
[Email protected] cmake-3.1.1]# mkdir-p/usr/local/mysql
Return to the/USR/LOCAL/SRC directory:
[Email protected]jhq0113 cmake-3.1.1]# CD/USR/LOCAL/SRC
Unzip MySQL:
[Email protected] src]# tar xzvf mysql-5.6.13.tar.gz
Go to MySQL Unzip directory:
[Email protected] src]# CD mysql-5.6.13
To precompile MySQL with cmake, this process may take some time:
[Email protected] mysql-5.6.13]# CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dsysconfdir=/etc/
Compile:
[[email protected] mysql-5.6.13]# make
Installation:
[[email protected] mysql-5.6.13]# make install
Copy the configuration file (if the/etc directory has a default MY.CNF, you can overwrite it directly):
[Email protected] support-files]# CP/USR/LOCAL/MYSQL/SUPPORT-FILES/MY-DEFAULT.CNF/ETC/INIT.D/MY.CNF
To add a MySQL path:
[Email protected] support-files]# VIM/ETC/MY.CNF
After modification:
To generate the MySQL system database:
[Email protected] support-files]#/usr/local/mysql/scripts/mysql_install_db–user=mysql–basedir=/usr/local/mysql– Datadir=/data/mysql
To start MySQL into the system:
[Email protected] support-files]# Cp/usr/local/mysql/support-files/mysql.server/etc/rc.d/init.d/mysqld
To increase mysqld execution permissions:
[Email protected] support-files]# chmod 755/etc/init.d/mysqld
Mysqld Join Boot:
[Email protected] support-files]# chkconfig mysqld on
To edit a configuration file:
[Email protected] support-files]# Vim/etc/init.d/mysqld
After modification:
Add the MySQL service to the system environment variable:
[Email protected] support-files]# Vim/etc/profile
After modification:
Link the MYSLQ library file to the default location of the system to ensure that you do not have to specify the MySQL library file address when compiling software like PHP.
[Email protected] support-files]# ln-s/usr/local/mysql/lib/mysql/usr/lib/mysql
[Email protected] support-files]# ln-s/usr/local/mysql/include/mysql/usr/include/mysql
Restart the system:
Reboot
To establish a connection:
[Email protected] ~]# ln-s/var/lib/mysql/mysql.sock/tmp/mysql.sock
Restart Mysqld:
[Email protected] ~]# service mysqld restart
To set the MySQL password:
[Email protected] support-files]#/usr/local/mysql/bin/mysql_secure_installation
To change the root password:
Default no password, direct enter, and then enter two times the password, all the way to press Y to enter down
To set up MySQL you can telnet:
[Email protected] ~]# mysql-uroot-p
Enter the password to log in, and then execute the following statement to limit the MySQL root user to telnet under the specified IP address
Mysql> Grant all privileges the "root ' 192.168.1.* '% ' identified by ' your password ';
Update Permissions:
mysql> flush Privileges;
Exit:
Mysql> exit;
This will allow your MySQL to log in remotely with Navicat within the 192.168.1.*.
At this point, MySQL installation is complete.
Install Nginx:
Install Nginx before you need to install Pcre, enter the/USR/LOCAL/SRC directory, unzip pcre, enter Pcre extract directory, execute the following command to compile and install:
[[email protected] pcre-8.35]#./configure–prefix=/usr/local/pcre && make && make install
Create a Web composite Web user that does not allow web users to log on directly to the system:
[Email protected] pcre-8.35]# Groupadd web
[Email protected] pcre-8.35]# useradd-g Web web-s/bin/false
Compile and install Nginx, unzip, enter the installation directory, execute the following command:
[Email protected] nginx-1.7.0]#./configure–prefix=/usr/local/nginx–without-http_memcached_module–user=web–group =web–with-http_stub_status_module–with-openssl=/usr/–with-pcre=/usr/local/src/pcre-8.35
Note: –with-pcre=/usr/local/src/pcre-8.31 points to the source package decompression path, not the installation path, otherwise it will be an error
Compile and install:
[[email protected] nginx-1.7.0]# make && make install
To edit the Nginx startup command:
[Email protected] nginx-1.7.0]# Vim/etc/init.d/nginx
Add the following content:
!/bin/bashnginx Startup script for the Nginx HTTP Serverit is v.0.0.2 version.chkconfig:-15description:nginx Gh-performance Web and Proxy server. It has a lot of features, but it's not for Everyone.processname:nginxpidfile:/var/run/nginx.pidconfig:/usr/local/nginx/ Conf/nginx.conf
Nginxd=/usr/local/nginx/sbin/nginx
Nginx_config=/usr/local/nginx/conf/nginx.conf
Nginx_pid=/usr/local/nginx/logs/nginx.pid
Retval=0
Prog= "Nginx"
Source function Library.
. /etc/rc.d/init.d/functions
Source networking configuration.
. /etc/sysconfig/network
Check that networking are up.
[${networking} = "No"] && exit 0
[-X $nginxd] | | Exit 0
Start Nginx daemons functions.
Start () {
If [-e $nginx _pid];then
echo "Nginx already running ..."
Exit 1
Fi
Echo-n "S TaRTINg Prog: "
Daemon Ng INxd ?C {Nginx_config}
Retval=$?
Echo
[$RETVAL = 0] && Touch/var/lock/subsys/nginx
Return $RETVAL
}
Stop Nginx daemons functions.
Stop () {
Echo-n "S ToPPINg Prog: "
Killproc $nginxd
Retval=$?
Echo
[$RETVAL = 0] && rm-f/var/lock/subsys/nginx/usr/local/nginx/logs/nginx.pid
}
Reload () {
Echo-n "ReLoad INg Prog: "
Kill-hup
cat ${nginx_pid}
Killproc $nginxd-hup
Retval=$?
Echo
}
See how we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Reload
Reload
;;
Restart
Stop
Start
;;
Status
Status $prog
Retval=$?
;;
*)
Echo u s a g e : Prog {start|stop|restart|reload|status|help} "
Exit 1
Esac
Exit $RETVAL
To give Nginx Execute permissions:
[Email protected] nginx-1.7.0]# chmod 775/etc/init.d/nginx
To set the Nginx boot up:
[[email protected] nginx-1.7.0]# chkconfig nginx on
Start Nginx:
[[Email protected] nginx-1.7.0]# service Nginx start
Test Nginx installation and startup status:
At this point, Nginx installation completed, to install PHP after the support of PHP and specify custom publishing directory settings.
To create a web directory:
[Email protected] nginx-1.7.0]# mkdir-p/home/data/web
Not to be continued!
CentOS6.6 32-bit minimal version plain compile install nginx Mysql PHP Memcached