In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
LNMP-"Source Code Packaging nginx mysql5.6 php
1. Install mysql
# unlock the mysql5.6 source code package first
# tar-zxf mysql-5.6.25.tar.gz
# cd mysql-5.6.25/
# useradd mysql
# yum-y install cmake gcc
# yum install gcc-c++
# yum-y install ncurses-devel
# cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DSYSCONFDIR=/etc-DMYSQL_DATADIR=/usr/local/mysql/data-DMYSQL_TCP_PORT=3306-DMYSQL_USER=mysql-DEXTRA_CHARSETS=all
# make & & make install
# cd / usr/local/mysql/
#. / scripts/mysql_install_db-- datadir=/usr/local/mysql/data/-- user=mysql (initialize the database)
# ls / usr/local/mysql/data/
# ls-l / usr/local/mysql/data/mysql
Copy the master profile startup script:
# ls support-files/
# cp support-files/my-default.cnf / etc/my.cnf
# cp support-files/mysql.server / etc/init.d/mysql
# chmod + x / etc/init.d/mysql
# chkcpmfig-add mysql (added as a system service)
# chkconfig-list mysql
# chkconfig mysql on
# service mysql status
# netstat-anptu | grep: 3306
# service mysql start
# ln-s / usr/local/mysql/* / bin add the path of the command to the path variable
# echo "export PATH=$PATH:/usr/local/mysql/bin" > > / etc/profile
# source / etc/profile
# echo $PATH
/ usr/local/mysql/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin
# mysql-uroot-p
Mysql > quit
Set the password for the database administrator to log in from this computer
# mysqladmin-hlocalhost-uroot password "123456" this is setting the password
# mysql-uroot-p123456
Mysql > quit
Modify the password
# mysqladmin-hlocalhost-uroot-p password "11" (new password)
Enter password: (fill in the old password)
# mysql-uroot-p11
# vim / etc/ls.so.conf (library file connection system starts to read this file, loads the program's library file, and third-party software can find the location of the mysql library file)
/ usr/local/mysql/lib/
# ldconfig-v | grep-I-- color mysql
two。 Install PHP
Install the expansion pack first to install PHP
Libmcrypt-2.5.8.tar.gz
Mhash-0.9.9.9.tar.gz
# tar zxf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9/
#. / configure
# make & & make install
# tar-zxf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8/
#. / configure
# make & & make install
Update the library files to the directory where the system is searched by default
# ln-s / usr/local/lib/libmcrypt* / usr/lib/
# ln-vs / usr/local/lib/libmhash.* / usr/lib/
# ldconfig-v
Install PHP
# tar zxf php-5.4.24.tar.gz
# cd php-5.4.24/
# / configure-- prefix=/usr/local/php5-- with-mysql=/usr/local/mysql-- enable-fpm-- enable-mbstring-- with-mcrypt-- with-mhash-- with-config-file-path=/usr/local/php5/etc-- with-mysqli=/usr/local/mysql/bin/mysql_config-- enable-memached
# yum list | grep xml2* (see the error above. Find out what is missing before you install it)
# yum-y install * xml2*
# / configure-- prefix=/usr/local/php5-- with-mysql=/usr/local/mysql-- enable-fpm-- enable-mbstring-- with-mcrypt-- with-mhash-- with-config-file-path=/usr/local/php5/etc-- with-mysqli=/usr/local/mysql/bin/mysql_config
# make & & make install
3. Install nginx
Configure the nginx service to receive a request to access the php file and send the request to port 9000 on this machine
Install nginx
# useradd nginx
# tar-zxf nginx-1.8.0.tar.gz
# cd nginx-1.8.0/
# yum-y install gcc gcc-c++ openssl openssl-devel pcre pcre-devel
Install dependency packages. Because lnmp is installed on a server, some have already been installed and can be compiled directly with. / configure. If any package is missing, you can report an error and then install it. It is generally the following dependencies:) [# yum-y install gcc zlib-devel openssl-devel]]
#. / configure-prefix=/usr/local/nginx-with-http_ssl_module-with-http_stub_status_module
# yum list | grep pcre
# yum-y install pcre*
#. / configure-prefix=/usr/local/nginx-with-http_ssl_module-with-http_stub_status_module
# make & & make install
# ln-s / usr/local/nginx/sbin/nginx / usr/sbin/
# netstat-anptu | grep nginx (first turn off the previous occupied port 80)
# nginx (# chkconfig nginx on here nginx does not have a startup script, so you cannot set a boot script to write a script)
# echo 1111 > / usr/local/nginx/html/test.html
# yum-y install elinks
# elinks-- dump http://localhost/test.html
1111
# vim / usr/local/nginx/conf/nginx.conf
65-71 comments removed
Line 69: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
# nginx-s reload
Write php script files
# cat / usr/local/nginx/html/test.php
Client access
# http://192.168.4.254/test.php (can interpret php code)
Test whether the php program can connect to the database
Turn on the database service first
# netstat-anptu | grep: 3306
Tcp 0 0: 3306: * LISTEN 2634/mysqld
# mysql-hlocalhost-uroot-p123456
Mysql > grant all on bbsdb.* to webadmin@ "localhost" identified by "123456"
Mysql > create database bbsdb
Mysql > quit
# vim / usr/local/nginx/html/db.php
test
# http://192.168.4.254/db.php
Ok
(no database is not open, what the test gets is err.)
4. Install memcached
Install the memcached service (memcache, memory storage-the package libevent,libevent and memache with event triggers to be installed first should be compatible with each other, here libevent-2.0.21,memcached-1.4.24)
Install libevent first
# yum-y install gcc
# tar-xf libevent-2.0.21-stable.tar.gz (memcached service library file)
# cd libevent-2.0.21-stable
#. / configure
# make & & make install
You can link to the library file directly or write it in the library configuration file, just do one of the following.
1) # ln-s / usr/local/lib/libevent/* / usr/lib/
# ldconfig (/ / refresh)
2) # vim / etc/ld.so.conf (configuration file for library files)
/ usr/local/lib/
# ldconfig (/ / refresh)
3) # vim / etc/ld.so.conf/libevent.conf
/ usr/local/lib/
# ldconfig
# tar-zxf memcached-1.4.24.tar.gz
# cd memcached-1.4.24
#. / configure
# make & & make install
# ln-s / usr/local/bin/memached / bin
# memcached-h (see help)
[root@proxe] # memcached-u root-m 64-vv-d starts memcached
# start memcached
Start with the following command
/ usr/local/memcached/bin/memcached-d-m 1024-u ths-l 198.28.1.237-p 11211-c 1024-P / tmp/memcached.pid
The above parameters are explained as follows:
The-d option is to start a daemon
-m is the amount of memory allocated to Memcache in MB, and this is 10MB.
-u is the user running Memcache. This is ths.
-l is the IP address of the listening server. If there are multiple addresses, I specify the IP address of the server 192.28.1.237.
-p is the port on which Memcache snooping is set. The default is 11211
The-c option is the maximum number of concurrent connections running. The default is 1024, which is set according to the load of your server.
-P is the pid file that is set to save Memcache. Here I save it in / tmp/memcached.pid
#
Check to see if the service is started:
[root@proxe ~] # netstat-anptu | grep: 11211
Tcp 0 0 0.0.0.0 11211 0.0.0.015 * LISTEN 6813/memcached
Tcp 0 0: 11211: * LISTEN 6813/memcached
Udp 0 0 0.0.0.0 11211 0.0.0.015 * 6813/memcached
Udp 0 0: 11211: * 6813/memcached
[memcached did not shut down the service script, kill the process pkill-9 memcached to stop the service]
Test:
[root@host b] # yum-y install telnet
[root@host b] # telnet 192.168.4.5 11211
Trying 192.168.4.5...
Connected to 192.168.4.5.
Escape character is'^]'.
Set name 0 100 3
Tom
STORED
Get name
VALUE name 0 3
Tom
END
Replace name 0 200 3
Asc
STORED
Get name
VALUE name 0 3
Asc
END
Add set replace delete get
# cd / usr/lcoal/bin
#. / php-m (view the features supported by php)
#. / php-m | grep memcached (check whether php supports memcached)
Let php support memcached
# cd
# tar-zxvf memcahce-2.2.5
# cd memcahce-2.2.5
# / usr/local/php5/bin/phpize
#. / configure-with-php-config=/usr/local/php5/bin/php-config-anable-memcache
# make & & make install
# vim / usr/local/php5/etc/php.ini
Extension_dir= "/ usr/local/php5nginx/lib/php/extensions/no-
Debug-non-zts-20100525/ "
Extension=memcache.so
# / etc/init.d/php-fpm restart
Modify the main configuration file of the nginx service and access port 11211 first when the request is received. (set to first look up from the cache and no longer query from the database)
# vim / usr/local/nginx/conf/nginx.conf
Write test files
# cat / usr/local/nginx/html/mem.php
# http://nginx-ip/mem.php
Jim
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.