This article has referred to Http://www.tuicool.com/articles/3iUNFnA and has made some additions to the details. Make the installation process smoother.
The first thing to say is that Ubuntu requires the sudo command, so start with sudo on the following commands.
Install some dependent resources first GCC g++ OpenSSL libssl-dev (RedHat, CentOS is Openssl-devel)
sudo apt-get install OpenSSL sudo apt-get install libssl-devsudo apt-get Install GCC g++
Nginx Installation
Nginx Source package: nginx, Password: bi79
Pcre Source package: pcre, Password: uvqd
Zlib Source package: zlib, Password: I6PF
After the download is complete, take my example, put in the/USR/LOCAL/SRC, three source package
TAR-ZXVF Source Package
For decompression.
Then go to the Nginx decompression directory.
CD Nginx Directory
Configuration inside the--prefix developed Nginx installation directory,--conf-path developed the Nginx configuration file directory, where the--with-pcre= behind the directory is Pcre source package directory,--with-zlib= The following is the path of the zlib source package.
sudo./configure--prefix=/usr/local--sbin-path=/usr/local/nginx/nginx--conf-path=/usr/local/nginx/nginx.conf-- Pid-path=/usr/local/nginx/nginx.pid--with-http_ssl_module--with-pcre=. /pcre-8.36 --with-zlib=. /zlib-1.2. 8
sudo make
sudo make install
Start Nginx
$/usr/local/nginx/nginx# Several commonly used nging commands $/usr/local/nginx-t #测试默认为值的配置文件是否ok $/usr/local/ Nginx-c/etc/nginx.conf #指定nginx解析的配置文件 $/usr/local/nginx-s stop|quit|reload|reopen #停止或者重启nginx
MySQL Installation
MySQL source bundle: mysql, password: 7qyu
MySQL installation uses cmake, no self-installation,
sudo apt-get install CMake
Install Ncurses-devel, under Ubuntu is
sudo apt-get
Set up MySQL users and user groups
-r-g MySQL MySQL
Create MySQL Directory
sudo mkdir-p/usr/local/-p/data/mysqldb
Unzip the downloaded MySQL source code
TAR-ZXVF Source Package
Go to the extracted MySQL directory
CD MySQL Directory
The-dcmake_install_prefix= in the command is followed by the MySQL installation directory,-dmysql_unix_addr= followed by the path of the listener socket, the default is/tmp/mysql.sock,-ddefault_ CharSet sets the server character set, which by default is the storage directory where MySQL data is latin1,-dmysql_datadir set.
sudo cmake-dcmake_install_prefix=/usr/local/mysql-dmysql_unix_addr=/usr/local/mysql/mysql.sock-ddefault_charset =utf8-ddefault_collation=utf8_general_ci-dwith_innobase_storage_engine=1 -dwith_archive_storage_engine =1 -dwith_blackhole_storage_engine=1 -dmysql_datadir=/data/mysqldb-dmysql_tcp_port=3306 -denable_downloads=1
End work
Modify the MySQL directory to belong to the user
cd/usr/local/-R mysql:mysql.
Modify the MySQL database file directory to which the user belongs
cd/usr/local/-R mysql:mysql.
Create a MY.CNF file
Cp/usr/local/mysql/support-files/my-deault.cnf/etc/my.cnf
Edit /etc/my.cn
, add the following configuration item
[Mysqld]port=3306socket=/usr/local/mysql/mysql.sockdatadir=/data/ Mysqldbcharacter_set_server=Utf8sql_mode=no_engine_substitution,strict_trans_tables [MySQL] Socket=/usr/local/mysql/mysql.sock[mysqladmin]socket=/usr/local/mysql/mysql.sock
Add MySQL to the service
sudo cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysqldservice mysqld status
if the MySQL information * MySQL is not running
can be displayed above then add the service OK
Initializing MySQL Database
cd/usr/local/mysqlsudo Scripts/mysql_install_db--user=mysql--datadir=/data/mysqldb
after executing the above command, view /data/mysqldb
content in the directory, if a content description was generated, the initialization was successful.
Start MySQL
| grep mysqld
If the above command can be seen after the mysqld process instructions to start MySQL successfully
Modify the MySQL root user password
cp/usr/local/mysql/bin/mysql/usr/bin//usr/local/mysql/bin/mysqladmin/usr/bin/' 123456'-u root-p# enter 123456 password
Execute the command of the evening side, and if you see Welcome to the MySQL monitor....
description MySQL installation, startup, connection OK.
Precautions
Since the MySQL-related directory is mysql:mysql, it is possible to try sudo to resolve the problem if there are problems.
There are a number of possible problems with starting the server after MySQL is installed:
configuration file, MySQL my.cnf
has a default order when loading the configuration file:
A./etc//etc/mysql//usr/local/mysql/~/my.cnf
So if there are some very strange problems to solve, be sure to check that the configuration file you want MySQL to load is loaded first.
PHP Installation
PHP Source Bundle: php-5.6.13.tar.gz
FreeType Source package: FreeType, Password: m5pc
FreeType will be used when generating the verification code (specifically, imagettftext this function)
Preparatory work
- FreeType installation--Generate a verification code that may be used
TAR-XVF freetype-2.4. 0 . TAR.BZ2CD FreeType-2.4. 0 . /configure--prefix=/usr/local/freetypemakemake Install
- Installing Curl, PNG, MCrypt
sudo apt-get Install Curl libcurl3 libcurl3-devsudo apt-get install libpng3 libpng3- Devsudo apt-get install libmcrypt4 libmcrypt-devsudo apt-get Install Libxml2-dev
Inside the installation configuration below. /usr/local/mysql installs the MySQL directory for you.
sudo./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--enable-fpm--enable-pcntl-- Enable-mysqlnd--enable-opcache--enable-sockets--enable-sysvmsg--enable-sysvsem --ENABLE-SYSVSHM-- Enable-shmop--enable-zip--enable-ftp--enable-soap--enable-xml--enable-mbstring--with-mysql=/usr/local/mysql- With-pdo-mysql=/usr/local/mysql--with-pcre-regex--with-iconv--with-zlib--with-mcrypt--with-gd--with-openssl-- With-mhash--with-xmlrpc--with-curl--with-imap-ssl--enable-pdo--with-freetype-dir=/usr/local/freetype
sudo make
sudo make install
PHP Configuration
- PHP.ini Management to see
/usr/local/php/etc
if the following configuration file, if there is a CP named PHP.ini, no words will be in the source package php.ini* copied a copy came to be named PHP.ini
- php-fpm.conf management php-fpm.conf generally in the installation directory of/usr/local/php/etc/php-fpm.conf.default this location
cd/usr/local/php/etccp php-fpm.conf. default php-fpm.conf
Modify the contents of the php-fpm.conf, mainly the binding IP, port or UNIX socket, below is my configuration, can be properly referenced
PID = run/php-Fpm.piderror_log= log/php-Fpm.loglog_level=noticedaemonize=Yesrlimit_files=1024x768User=Nobodygroup=Nobodylisten=127.0.0.1:9000pm=DynamicPm.max_children=5pm.start_servers=2pm.min_spare_servers=1pm.max_spare_servers=3
Start PHP-FPM
$CP/usr/local/php/sbin/php-fpm/usr/bin/php-fpm$php-fpm-t #测试默认配置文件是否ok $php-| grep php-fpm
If you see PHP-FPM, the process indicates that PHP-FPM started successfully. The end of the PHP-FPM
$kill-int ' cat/usr/local/php/var/run/php-fpm.pid '
Finish!!!
Ubuntu 14.04 nginx + mysql + PHP source installation