Ubuntu10.10 install nginxphpmysql

Source: Internet
Author: User
Tags apc
Forum.ubuntu.org. cnviewtopic. php? T319886 I am a beginner and cannot write well. Thank you ~ I had a forum this afternoon. I didn't find a proper installation and configuration tutorial for MYSQL. I had to go to the official documentation on my own. It took a lot of time. The following is my operation process and I wrote it out, I hope it will be helpful to you ., Http

Http://forum.ubuntu.org.cn/viewtopic.php? T = 319886 when you are a beginner, you may not be able to write well ~ I had a forum this afternoon. I didn't find a proper installation and configuration tutorial for MYSQL. I had to go to the official documentation on my own. It took a lot of time. The following is my operation process and I wrote it out, I hope it will be helpful to you. , Http

Http://forum.ubuntu.org.cn/viewtopic.php? T = 319886
I am a beginner and cannot write well. Thank you ~ I had a forum this afternoon. I didn't find a proper installation and configuration tutorial for MYSQL, so I had to go to the official documentation on my own. It took some time,
The following is my operation process. I hope it will be helpful to you.

Http://dev.mysql.com/downloads/mysql/
Download source code: source code
File: mysql-5.5.9.tar.gz
After the download, go to the download directory.
$ Sudo tar zxvf mysql-5.5.9.tar.gz
View the INSTALL-SOURCE file in the folder, which contains the compilation and installation methods for each system)
Note: You should pay attention to the improvement of the Installation tool before installation. Otherwise, an error will occur during compilation. A list of tools will be provided later in this post. The installation command is provided first.
Install the source code in linux as follows:

# Pre-installation Configuration
Shell> groupadd mysql
Shell> useradd-r-g mysql

# Start source code compilation and Installation
Shell> tar zxvf mysql-VERSION.tar.gz
Shell> cd mysql-VERSION
Shell> cmake.
Shell> make
Shell> make install
# End compilation and Installation

# Initialization: run the following commands to enable mysql to gain ownership of database files. The mysql_install_db script can refresh the authorization table.
Shell> cd/usr/local/mysql
Shell> chown-R mysql.
Shell> chgrp-R mysql.
Shell> scripts/mysql_install_db -- user = mysql
Shell> chown-R root.
Shell> chown-R mysql data
# Optional commands. The configuration file location is changed and there are five configuration modes.
Shells> cp support-files/my-medium.cnf/etc/my. cnf
Shell> bin/mysqld_safe -- user = mysql &
# Optional command, self-starting script, which can be automatically started by mysql.
Shell> cp support-files/mysql. server/etc/init. d/mysql. server

Problems:
----------------------------------------------------------
-- MySQL 5.5.9
-- Cocould NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline. cmake: 82 (MESSAGE ):
Curses library not found. Please install appropriate package, remove CMakeCache.txt and rerun cmake. On Debian/Ubuntu, package name is libncurses5-dev, on RedHat and derivates it is ncurses-devel.
Call Stack (most recent call first ):
Cmake/readline. cmake: 126 (FIND_CURSES)
Cmake/readline. cmake: 216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt: 256 (MYSQL_CHECK_READLINE)
----------------------------------------------------------
Failed (must be deleted; otherwise, an error will still be reported) and run again:
$ Cmake.
Command
----------------------------------------------------------
-- Specify Ming Test HAVE_PEERCRED
-- Specify Ming Test HAVE_PEERCRED-Success
Warning: Bison executable not found in PATH
-- Processing ing done
-- Generating done
-- Build files have been written to:/home/user/downloads/mysql-5.5.9
----------------------------------------------------------
A warning was finally unpleasant. As you can see, install bison.
$ Sudo apt-get install bison
----------------------------------------------------------
There are two more problems.



Summary:
Later, I checked the official documents and required the following five tools during compilation and installation.
=> Installation tool:
1. cmake
---- You have not compiled and installed cmake yourself.
---- Shell :~ $ Sudo apt-get install cmake
---- Version: 2.8.2
2. GNU make
---- Ubuntu built-in
---- Version 3.81
3. GCC
---- Ubuntu built-in
---- Version: 4.4.5 (Official Document: Must be later than 3.2)
4. Perl
---- Ubuntu built-in
---- Version: 5.10.1
5. libncurses5-dev (ncurses-devel)
---- If this package is missing, an error will be reported during cmake.
---- The package name On Debian/Ubuntu is libncurses5-dev, and RedHat corresponds to ncurses-devel in other versions
---- Shell :~ $ Sudo apt-get install libncurses5-dev




Enable mysql:
Cd ..;./bin/mysqld_safe &
Of course, when you use the root command to enable it, you should use the -- user parameter. This is a safe start method.
Cd ..;./bin/mysqld_safe -- user = mysql &

Set the password for the root user and your username. This requires you to start mysql first. Otherwise, an error is reported, indicating that you are not connected to the Port:
./Bin/mysqladmin-u root password 'new-password'
./Bin/mysqladmin-u root-h YourusernamE password 'new-password'
You can also use the following command instead:
./Bin/mysql_secure_installation


2. Compile and install php-fpm

# Related code, [programmer] http://www.coder4.com
# Download
Wget http://us.php.net/distributions/php-5.3.6.tar.bz2
Tar-xjvf php-5.3.6.tar.bz2
Cd php-5.3.6

# Related libraries
Sudo apt-get install libxml2-dev zlib1g-dev libcurl4-openssl-dev libpng12-dev libmcrypt-dev

# Configure
'. /Configure ''-- prefix =/usr/local/php'' -- with-config-file-path =/etc/php'' -- disable-cli'' -- enable-fpm ''-- with-fpm-user = www'' -- with-fpm-group = www ''-- with-zlib'' -- with-curl ''-- with-gd'' -- with-mhash ''-- enable-mbstring'' -- with-mcrypt ''-- with-mysql =/usr/local/mysql'' -- with-mysqli =/usr/local /mysql/bin/mysql_config ''-- enable-pdo'' -- enable-soap ''-- enable-sockets'' -- with-xmlrpc ''-- enable-zip'' -- -pear'

# Make
Make

Error prompted
/Usr/local/mysql/include/mysql/my_sys.h: 964: 27: error: mysql/psi. h: No such file or directory
/Usr/local/mysql/include/mysql/m_string.h: 219: 26: error: mysql/plugin. h: No such file or directory
/Usr/local/mysql/include/plugin. h: 51: 28: Error: mysql/services. h: No file or directory
/Usr/local/mysql/include/services. h: 21: 39: Error: mysql/service_my_snprintf.h: No file or directory
/Usr/local/mysql/include/services. h: 22: 37: Error: mysql/service_thd_alloc.h: the file or directory does not exist.
/Usr/local/mysql/include/services. h: 23: 36: Error: mysql/service_thd_wait.h: No file or directory
/Usr/local/mysql/include/services. h: 24: 44: Error: mysql/service_thread_scheduler.h: the file or directory does not exist.
# Fixing MySQL bugs
Mkdir/usr/local/mysql/include/mysql
Ln-s/usr/local/mysql/include/*/usr/local/mysql/include/mysql
Vi/usr/local/mysql/include/my_sys.h
Find
# Include
Change
# Include

Vi/usr/local/mysql/include/m_string.h
Find
# Include <mysql/plugin. h>
Change
# Include
Vi/usr/local/mysql/include/plugin. h
Find
# Include
Change
# Include

The following error occurs:
Ext/gd/libgd/. libs/gdkanji. o: In function 'do _ convert ':
/Root/php-5.2.12/ext/gd/libgd/gdkanji. c: 350: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/gd/libgd/gdkanji. c: 365: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/gd/libgd/gdkanji. c: 381: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_strlen ':
/Root/php-5.2.12/ext/iconv. c: 603: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 626: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 660: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function 'php _ iconv_string ':
/Root/php-5.2.12/ext/iconv. c: 441: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 453: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 467: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 478: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_strpos ':
/Root/php-5.2.12/ext/iconv. c: 851: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 879: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 993: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_appendl ':
/Root/php-5.2.12/ext/iconv. c: 348: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 385: undefined reference to 'libiconv'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_substr ':
/Root/php-5.2.12/ext/iconv. c: 723: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 747: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 802: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 806: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 755: undefined reference to 'libiconv _ open'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_mime_decode ':
/Root/php-5.2.12/ext/iconv. c: 1354: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 1465: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 1468: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 1823: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 1826: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function 'php _ iconv_stream_filter_dtor ':
/Root/php-5.2.12/ext/iconv. c: 2465: undefined reference to 'libiconv _ close'
Ext/iconv/. libs/iconv. o: In function '_ php_iconv_mime_encode ':
/Root/php-5.2.12/ext/iconv. c: 1043: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 1057: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/iconv. c: 1316: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 1319: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 1176: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 1128: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 1160: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 1319: undefined reference to 'libiconv _ close'
/Root/php-5.2.12/ext/iconv. c: 1228: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 1259: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 1303: undefined reference to 'libiconv'
Ext/iconv/. libs/iconv. o: In function 'php _ iconv_stream_filter_append_bucket ':
/Root/php-5.2.12/ext/iconv. c: 2615: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/iconv. c: 2615: undefined reference to 'libiconv'
Ext/iconv/. libs/iconv. o:/root/php-5.2.12/ext/iconv. c: 2537: more undefined references to 'libiconv' follow
Ext/iconv/. libs/iconv. o: In function 'php _ iconv_stream_filter_ctor ':
/Root/php-5.2.12/ext/iconv. c: 2491: undefined reference to 'libiconv _ open'
Ext/xmlrpc/libxmlrpc/. libs/encodings. o: In function 'convert ':
/Root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings. c: 73: undefined reference to 'libiconv _ open'
/Root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings. c: 81: undefined reference to 'libiconv'
/Root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings. c: 101: undefined reference to 'libiconv _ close'
Collect2: ld returned 1 exit status
Make: *** [sapi/cli/php]? .. 1

Solution:
[Root @ server3 ~] $ Vim Makefile
Find the following line:
EXTRA_LIBS =-lcrypt add-liconv at the end, save it, make it through, and then make install.
Bytes ------------------------------------------------------------------------------------------------------------------------------
EXTRA_LIBS =-lcrypt-lz-lcrypt-lrt-lmysqlclient-lmhash-lmcrypt-lltdl-lldap-llber-lfreetype-lpng-lz-lj
Peg-lcurl-lz-lrt-lresolv-lm-ldl-lnsl-lrt-lxml2-lz-lm-lssl-lcrypto-ldl-lz-lcurl-ldl-lgssapi_krb5
-Lkrb5-lk5crypto-lcom_err-lidn-lssl-lcrypto-lz-lxml2-lz-lm-lmysqlclient-lz-lcrypt-lnsl-lm-lxml2-lz
-Lm-lxml2-lz-lm-lcrypt-lxml2-lz-lm-lxml2-lz-lm-lxml2-lz-lm-lxml2-lz-lm-lcrypt-liconv
Slave --------------------------------------------------------------------------------------------------------------------------------
Make clean
Make

# Install
Sudo make install

# User
Cd/usr/local/php
Useradd www
Sudo chown-R www: www ./

# Copy php configurations
Sudo mkdir-p/etc/php
Sudo cp php. ini-production/etc/php. ini

# Configuration
Sudo vim./etc/php-fpm.conf
Rlimit_files = 1048576
Pm. max_children = 10
Pm. start_servers = 4
Pm. min_spare_servers = 2
Pm. max_spare_servers = 10
Pm. max_requests = 100

# Run
./Sbin/php-fpm

# Add to startup
Ln-s/usr/local/php/sbin/php-fpm/usr/bin/
Vim/etc/rc. local
# Start php-fpm at start
Echo 134217728>/proc/sys/kernel/shmmax
Php-fpm

# Install APC
Wget http://pecl.php.net/get/APC-3.1.6.tgz
Tar-xzvf APC-3.1.6.tgz
Cd APC-3.1.6
Sudo apt-get install autoconf
/Usr/local/php/bin/phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config
Make
Sudo make install
# Editing
Vim/etc/sysconfig/php. ini
# Modify and add
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626"
Extension = apc. so
[Apc]
Apc. enabled = 1
Apc. shm_segments = 2
Apc. shm_size = 48 M

3. Compile and install nginx

# Download
Wget http://nginx.org/download/nginx-0.8.54.tar.gz
Tar-xzvf nginx-0.8.54.tar.gz

# Install related packages
Sudo apt-get install libpcre3-dev libmhash-dev

# Nginx http push module

Http://pushmodule.slact.net/downloads/nginx_http_push_module-0.692.tar.gz

# Nginx chunkin module

Https://github.com/agentzh/chunkin-nginx-module/zipball/v0.21


# Configure
. /Configure -- user = www -- group = www -- prefix =/usr/local/nginx -- with-http_stub_status_module -- add-module =/home/lost/packet/agentzh-chunkin-nginx-module -- with-http_ssl_module -- add-module =/home/lost/packet/nginx_http_push_module-0.692
# Make
Make
# Install
Sudo make install
Cd/usr/local/nginx
Sudo chown-R www: www.

# Configure nginx. conf
Sudo vim conf/nginx. conf
# As follows
User www;
Worker_processes 2;

Error_log/usr/local/nginx/logs/error. log;
Pid/usr/local/nginx/logs/nginx. pid;

Worker_rlimit_nofile 1048576;

Events {
Use epoll;
Worker_connections 65535;
}

Http {
Include mime. types;
Default_type application/octet-stream;

Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "'
'$ Status $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "';

Sendfile on;
Tcp_nopush on;

# Keepalive_timeout 0;
Keepalive_timeout 60;

# Gzip
Gzip on;
Gzip_min_length 1 k;
Gzip_buffers 4 16 k;
Gzip_http_version 1.0;
Gzip_comp_level 6;
Gzip_types text/plain application/x-javascript text/css application/xml;
Gzip_vary on;

Server {
Listen 80;
Server_name node11.coder4.com;
Root/usr/local/nginx/html;
Access_log/usr/local/nginx/logs/node11.coder4.com. access. log main;

Location /{
Index. php index.html index.htm;
}

# Redirect server error pages to the static page/50x.html
Error_page 404/404 .html;
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}

# Pass the PHP scripts to FastCGI server listening on Fig: 9000
Location ~ /. Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi_params;
}

# Deny htaccess
Location ~ //. Ht {
Deny all;
}

# Ip
Location ~ . */. (Gif | jpg | jpeg | png | bmp | swf | ico) $ {
Expires 30d;
Access_log off;
}
}
}

# Configure fastcgi_params
Sudo vim conf/fastcgi_params
# Add a row
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

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.