Software source code package storage location: /usr/local/src
Source code package compilation and installation location: /usr/local/software name
**Edit source: **
1、 Enter the folder where the source configuration is stored
cd /etc/yum.repos.d
2、 Backup default source
mv ./CentOS-Base.repo ./CentOS-Base.repo.bak
3、 Use wget to download the source of 163
wget http://mirrors.163.com/.help/CentOS-Base-163.repo
4、 Put the downloaded file CentOS-Base-163.repo set as default source
mv CentOS-Base-163.repo CentOS-Base.repo
Install git
yum install git
See http for common git commands://www.cnblogs.com/whoamme/p/3531387.html
One, close SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #Comment out
#SELINUXTYPE=targeted #Comment out
SELINUX=disabled #increase
:wq save, close
shutdown -r now #Restart the system
2. Download the software package
1. Download apache
wget apache.dataguru.cn/httpd/httpd-2.4.7.tar.gz
**2. Download **mysql
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.35.tar.gz
3. Download php 5.5.8
wget cn2.php.net/get/php-5.5.8.tar.gz/from/this/mirror
4. Download cmake (MySQL compilation tool)
wget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz
5. Download libmcrypt (PHPlibmcrypt module)
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
6. Download apr (Apache library file)
wget mirror.bit.edu.cn/apache/apr/apr-1.5.0.tar.gz
7. Download apr-util (Apache library file)
wget mirror.bit.edu.cn/apache/apr/apr-util-1.5.3.tar.gz
Three, installation
Preparation: Compilation tools and library files (use CentOS yum command to install)
yum install make apr* autoconf automake 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 keyutils-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
1、 Install libmcrypt
cd /usr/local/src
tar zxvf libmcrypt-2.5.7.tar.gz #unzip
cd libmcrypt-2.5.7 #Enter the directory
./configure #Configuration
make #compile
make install #install
2、 Install cmake
cd /usr/local/src
tar zxvf cmake-2.8.7.tar.gz
cd cmake-2.8.7
./configure
make #compile
make install #install
3、 Install apr
** Uninstall the old version first**
** yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs**
cd /usr/local/src
tar zxvf apr-1.5.0.tar.gz
cd apr-1.5.0
. /configure --prefix=/usr/local/apr
make
make install
4、 Install apr-util
tar zxvf apr-util-1.5.3.tar.gz
cd apr-util-1.5.3
. /configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
5、 Install mysql
Go back to the cmake directory and delete the cmakecache.txt file
rm -f CMakeCache.txt
groupadd mysql #Add mysql group
useradd -g mysql mysql -s /bin/false #Create user mysql and join the mysql group, not allowing mysql users to log in to the system directly
mkdir -p /data/mysql #Create MySQL database storage directory
chown -R mysql:mysql /data/mysql #Set MySQL database directory permissions
mkdir -p /usr/local/mysql #Create MySQL installation directory
cd /usr/local/src
tar zxvf mysql-5.5.21.tar.gz #unzip
cd mysql-5.5.21
cmake .-DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc #Configuration
make #compile
make install #install
cd /usr/local/mysql
cp ./support-files/my-huge.cnf /etc/my.cnf #copy the configuration file (note: there is a my.cnf in the /etc directory by default, just overwrite it)
vi /etc/my.cnf #Edit the configuration file, add in the [mysqld] section
datadir = /data/mysql #Add MySQL database path
./scripts/mysql_install_db --user=mysql #Generate mysql system database
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #Add Mysql to system startup
chmod 755 /etc/init.d/mysqld #Increase execution permissions
chkconfig mysqld on #Add boot start
vi /etc/rc.d/init.d/mysqld #Edit
basedir = /usr/local/mysql #MySQL program installation path
datadir = /data/mysql #MySQl database storage directory
service mysqld start #start
vi /etc/profile #Add mysql service to system environment variables: add the following line at the end
export PATH=$PATH:/usr/local/mysql/bin
The following two lines link the myslq library file to the default location of the system, so that you do not need to specify the mysql library file address when compiling software like PHP.
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
shutdown -r now #Need to restart the system, wait for the system to restart and continue to operate under the terminal command line
mysql_secure_installation #Set Mysql password
According to the prompt, press Y and enter the password twice
Or directly modify the password /usr/local/mysql/bin/mysqladmin -u root -p password "123456" #Modify the password
service mysqld restart #restart
At this point, mysql installation is complete!
6、 Install apache2
cd /usr/local/src
tar -zvxf httpd-2.4.1.tar.gz
cd httpd-2.4.1
mkdir -p /usr/local/apache2 #Create installation directory
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable- ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi #configuration
make #compile
make install #install
/usr/local/apache2/bin/apachectl -k start #start
vi /usr/local/apache2/conf/httpd.conf #Edit configuration file
Found: #ServerName www.example.com:80
Modified to: ServerName www.osyunwei.com:80
Find: DirectoryIndex index.html
Modified to: DirectoryIndex index.html index.php
Find: Options Indexes FollowSymLinks
Modified to: Options FollowSymLinks #Do not display the directory structure
Find AllowOverride None
Modified to: AllowOverride All #Open apache to support pseudo-static, modify both of them
LoadModule rewrite_module modules/mod_rewrite.so #Cancel the previous comment, open apache to support pseudo-static
vi /etc/profile #Add apache service system environment variables
Add the following line at the end
export PATH=$PATH:/usr/local/apache2/bin
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd #Add apache to the system startup
vi /etc/init.d/httpd #Edit file
Add the following two lines under #!/bin/sh
#chkconfig:2345 10 90
#descrption:Activates/Deactivates Apache Web Server
chown daemon.daemon -R /usr/local/apache2/htdocs #change directory owner
chmod 700 /usr/local/apache2/htdocs -R #change apache website directory permissions
chkconfig httpd on #Set boot up
/etc/init.d/httpd start
** service httpd restart**
7、 Install PHP5
** cd /usr/local/src**
tar -zvxf php-5.3.10.tar.gz
cd php-5.3.10
mkdir -p /usr/local/php5 #Establish php installation directory
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with -mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv- -with-freetype --with-jpeg --with-png --with-zlib --with-libxml --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-force-cgi-redirect --enable- mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --with-mime-magic --enable-suhosin --enable-session --with-mcrypt --with-jpeg --enable-fpm #Configuration
make #compile
make install #install
mkdir /usr/local/php5/etc
cp php.ini-production /usr/local/php5/etc/php.ini #Copy the php configuration file to the installation directory
rm -rf /etc/php.ini #Delete the configuration file that comes with the system
ln -s /usr/local/php5/etc/php.ini /etc/php.ini #Create configuration file soft link
vi /usr/local/php5/etc/php.ini #Edit
Found: ;open_basedir =
Modified to: open_basedir = .:/tmp/ #Prevent php Trojans from crossing sites, important!!
Found: disable_functions =
Modified to: disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,
ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,
disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,
posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid,
posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
#List the functions that PHP can disable. If some programs need to use this function, you can delete and cancel the disable.
Found: ;date.timezone =
Amend to: date.timezone = PRC
Find: expose_php = On
Modified to: expose_php = OFF #Prohibit displaying the php version information
Found: display_errors = On
Modified to: display_errors = OFF #Close the error prompt
Configure apache to support php
vi /usr/local/apache2/conf/httpd.conf #Edit apache configuration file
Add below the line LoadModule php5_module modules/libphp5.so,
AddType application/x-httpd-php.php (Note: There is a space before the dot in php.php)
service httpd restart #Restart apache
service mysqld restart #Restart mysql
At this point, the basic LAMP environment is compiled, you can write a test file to test it.
Fourth, install redis service and php redis extension
wget -c http://prdownloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
tar``-zxvf tcl8.6.1-src.tar.gz
cd`` tcl8.6.1/unix
./configure
make``&& make`` install
wget -c http://download.redis.io/releases/redis-2.6.16.tar.gz
tar``-zxvf redis-2.6.16.tar.gz
cd`` redis-2.6.16
make (if linux32 bit, use make CFLAGS="-march=i686")
make``test
make``install
vim /usr/local/src/redis-2.6.16/redis.conf //Set daemonize to yes
/usr/local/bin/redis-server``/usr/local/src/redis-2.6.16/redis.conf
ps, aux|grep, redis view process
[root@localhost redis-2.6.16]# redis-cli
redis 127.0.0.1:6379> set``name silenceper
OK
redis 127.0.0.1:6379> get name
"silenceper"
redis 127.0.0.1:6379>
To shut down, use the command redis-cli shutdown
redis-cli --help See more options
About redis 2.4 configuration file Chinese description:
https://github.com/silenceper/my/blob/master/config/redis2.4.chinese
Redis command manual:
http://redis.readthedocs.org/en/latest/
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
Put the program in the apache source code directory, configure the vhost, and find a blank screen after accessing it. The test vhost can be accessed normally.
Check the includes/common.inc.php source code:
require dirname(FILE) . '/../vendor/autoload.php';
I was missing a vendor directory and asked about Sanjin Guo. San Jin Guo said that this program relies on predis instead of redis's php extension, and it needs to download predis and place it in the vendor directory. . .
cd``phpRedisAdmin
git clone https://github.com/nrk/predis.git **vendor**
git clone git://github.com/nicolasff/phpredis.git
cd phpredis
/usr/local/php5/bin/phpize
./configure --with-php-config=/usr/local/php5/bin/php-config --enable-redis
make
make install
Configure php.ini
vim /usr/local/php5/etc/php.ini
Modify extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-zts-20121212/"
Add extension=redis.so //open redis extension
Restart the apache server, /usr/local/php5/bin/php -m
You can see that there is redis extension
Recommended Posts