Latest Ubuntu12.04 64bit environment installation tutorial

Source: Internet
Author: User
Tags fpm geoip gettext openssl pack svn dotfiles install redis

Operating system version: Ubuntu 12.04 64bit

Use the root account to log on to the system and create related directories.

Download path

/Home/ubuntu/down

Installation directory

/Usr/local/php # install php-5.4.3

/Usr/local/mysql # install mysql5.5.25

/Usr/local/openresty # ngx_openresty-1.0.15.9

/Usr/local/redis #2.4.14

Storage

/Storage/redis

Configuration file path:

Php configuration

/Usr/local/php/etc/php. ini

/Usr/local/php/etc/php/php-fpm.ini

Nginx configuration

/Usr/local/openresty/nginx/conf

The code path for project deployment is under the entire directory of the sub-project. There are actually a lot of mixed code here. How can this be better organized?

/Source/

/Source/restybuddy

After installing the system, set the root permission

Set root account

Sudo passwd root # set the root password

Su-root # switch to root

Replace the nearest source of the server

Cp/etc/apt/sources. list/etc/apt/sources. list. bak

Vim/etc/apt/sources. list

Check which country you belong to and replace the fastest source. This will make updates faster.

Update server time (different time zones can be changed by yourself)

Rm-rf/etc/localtime

Ln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtime

Modify system time

Apt-get install-y ntpdate

Ntpdate-u pool.ntp.org

Date

Upgrade System components

Apt-get update

Apt-get autoremove-y

Apt-get-fy install

Apt-get install-y build-essential gcc g ++ make

For packages in build-essential gcc g ++ make automake autoconf re2c wget cron bzip2 libzip-dev libc6-dev file rcconf flex vim nano bison m4 gawk less make cpp binutils diffutils unzip tar bzip2 libbz2-dev unrar p7zip libncurses5-dev connector libncurses5-dev libncurses5-dev libtool libevent-dev libpcre3 libpcre3-dev connector libssl-dev zlibc openssl libsasl2-dev libxml2 libxml2-dev libltdl3-dev libltdl-dev libmcrypt-dev libmysqlclient15-dev zlib1g zlib1g-dev libbz2-1.0 libglib2.0-0 libglib2.0-dev libpng3 runtime libbz2-dev lib120062 libjpeg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libmhash2 libmhash-dev libpq-dev libpq5 gettext libncurses5-dev libcurl4-gnutls-dev libjpeg-dev libpng12-dev libxml2-dev zlib1g-dev libssl-libdev curl3 libfreetype6-dev libcurl4-openssl-dev mcrypt libcap- dev;

Do apt-get install-y $ packages-force-yes; apt-get-fy install; apt-get-y autoremove; done

Install language pack

Apt-get install language-pack-zh-hans language-pack-zh-hant

The server supports Chinese characters. If the code contains Chinese characters, you can set it or not.

Export LC_ALL = "zh_CN.UTF-8 & Prime;

Install vitualbox tools on a virtual machine

Now we need to go to the client operating system, my ubuntu, and run a command line console to mount the virtual optical drive.

Mkdir/mnt/cdrom // create the cdrom Directory

Mount/dev/cdrom/mnt/cdrom // mount cdrom

Enter cdrom and run VBoxLinuxAdditions. run (note: If the client is windows, run vboxlinuxadditions.exe ):

Cd/mnt/cdrom

Sh./VBoxLinuxAdditions. run

 

Set Nic on virtual machine

1. Configure nat to access the Internet based on the local machine

2. set to host-only, and then there is a problem with the virtual box on the mac. Add a host in the preference settings, after host 192.168.56.1 is added, dhcp is enabled here, but the VM cannot be obtained.

After configuration, you need to set the ip address in the VM. After 192.168.56.2, you can access the VM through both the host and VM.

3. Now we can drive it for a long time.

Configure multiple NIC ip addresses

Vim/etc/network/interfaces

Add

# This file describes the network interfaces available on your system

# And how to activate them. For more information, see interfaces (5 ).

 

# The loopback network interface

Auto lo

Iface lo inet loopback

 

# The primary network interface

Auto eth0

Iface eth0 inet dhcp

 

Auto eth1

Iface eth1 inet static

Address 192.168.56.3

Netmask 255.255.255.0

Network 192.168.56.0

Broadcast 192.168.56.255

Gatway 192.168.56.1

Restart the NIC

/Etc/init. d/networking restart

Install JRE

Sudo apt-get install openjdk-7-jre-headless

Configure startup

Support for securecrt Upload (I have not installed securecrt in WIN)

Sudo apt-get install chkconfig

Sudo apt-get install cmake

Sudo apt-get install libncurses5-dev

Sudo apt-get install bison

Install git

Apt-get install-y git

Install svn

Apt-get install-y subversion

Set the default language and LC

Vim ~ /. Add bashrc

Export LANG = en_US: zh_CN.UTF-8

Export LC_ALL = C

Source ~ /. Bashrc

Configure ssh to automatically log on to ubuntu

Generate rsa_pub

Ssh-keygen-t rsa

If the user name is different from the user name of the target machine, modify the file.

Vim ~ /. Ssh/config

Add multiple rows:

Host 192.168.56.3

User ubuntu

Copy the authorized key multiple times:

Cat ~ /. Ssh/id_rsa.pub | ssh ubuntu@192.168.56.3 "cat> ~ /. Ssh/authorized_keys"

Next we can

Ssh ubuntu@192.168.56.3 automatic login

Install MySQL 5.5.25

Apt-get install bar

Apt-get install libncurses5-dev

Groupadd mysql

Useradd-s/sbin/nologin-g mysql

Wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.25.tar.gz/from/http://ftp.jaist.ac.jp/pub/mysql/

Tar zxvf myql-5.5.25.tar.gz

Music mysql-5.5.25 mysql

Cd mysql-5.5.25

Cmake-DCMAKE_INSTALL_PREFIX: PATH =/usr/local/mysql/-DSYSCONFDIR =/usr/local/mysql/etc/-DMYSQL_DATADIR =/usr/local/mysql/data-DMYSQL_UNIX_ADDR =/tmp/mysql. sock-DDEFAULT_CHARSET = utf8-DDEFAULT_COLLATION = utf8_general_ci-DWITH_READLINE = 1-DWITH_EMBEDDED_SERVER = 1-DWITH_SSL = bundled-records = 3306-records = 1-records = 1-LH

Make

Make install

Cd/usr/local/mysql

Chown-R mysql.

Chgrp-R mysql.

Sudo install-m644/usr/local/mysql/support-files/my-medium.cnf./etc/my. cnf

Sudo/usr/local/mysql/scripts/mysql_install_db-user = mysql-basedir =/usr/local/mysql-datadir =/usr/local/mysql/data

Sudo install-m755/usr/local/mysql/support-files/mysql. server/etc/init. d/mysqld

Sudo ln-s/usr/local/mysql/bin/mysql/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysqladmin/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysqld_safe/usr/bin/

Sudo ln-s/usr/local/mysql/bin/mysql_conf/usr/bin/

Sudo ln-s/usr/local/mysql/share/mysql. server/usr/bin/

Vim./etc/my. cnf

Add under [mysqld]

Datadir =/usr/local/mysql/data

Language =/usr/local/mysql/share/english # Here is the language configuration item

/Etc/init. d/mysqld start

Set the root command for mysql

Mysqladmin-h 127.0.0.1-u root password 123456

/Etc/init. d/mysqld status

Try to log in

./Mysql-u root-p

Use mysql;

Update user set Host = "%" where User = "root" and Host = "localhost ";

You need to modify bind_address in my. cnf configuration

Set automatic start upon startup

Update-rc.d: mysqld ULTS

Check whether chkconfig-list mysqld is set successfully.

Install MySQL 5.1.63

Groupadd mysql

Useradd-g mysql

Mkdir-p/usr/local/mysql5001

Mkdir-p/usr/local/mysql5001/data

Mkdir-p/usr/local/mysql5001/etc

. /Configure-prefix =/usr/local/mysql5001/-localstatedir =/usr/local/mysql5001/data/-sysconfdir =/usr/local/mysql5001/etc/-with-charset = utf8

Make

Make install

Chown-R root: mysql/usr/local/mysql5001

Chown-R mysql: mysql/storage/mysql5001

Chown-R mysql: mysql/usr/local/mysql5001/lib

Cd/usr/local/mysql5001/bin

Cp/usr/local/mysql5001/share/mysql. server/etc/init. d/mysqld5001

Cp/usr/local/mysql5001/share/mysql/my-medium.cnf/usr/local/mysql5001/etc/my. cnf

./Mysql_install_db-user = mysql

./Mysql-u root-P 5001-p

Use mysql;

Update user set Host = "%" where User = "root" and Host = "localhost ";

Flush privileges;

 
Php 5.4.3 install

Install PHP 5.4.3

Apt-get install php5-gd

Apt-get install libxpm-dev

Apt-get build-dep t1lib

Apt-get install libxslt-dev

Apt-get install libt1-dev

Apt-get install libmysql ++-dev

./Configure-prefix =/usr/local/php

-With-config-file-path =/usr/local/php/etc

-With-curl

-With-pear

-With-gd

-With-jpeg-dir-with-png-dir-with-zlib

-With-freetype-dir-with-t1lib

-With-mcrypt

-With-mhash

-With-mysql-with-mysqli

-With-pdo-mysql-with-openssl

-With-xmlrpc

-With-xsl

With-bz2

-With-gettext

-With-fpm-user = www-data-with-fpm-group = www-data-enable-fpm

-Enable-exif

-Enable-wddx

-Enable-zip

-Enable-bcmath

-Enable-calendar

-Enable-ftp

-Enable-mbstring

-Enable-soap

-Enable-sockets

-Enable-shmop

-Enable-dba

-Enable-sysvmsg

-Enable-sysvsem

-Enable-sysvshm

 

Make & make install

Add the PHP path to path

Vim ~ /. Bashrc

Export PATH = "$ PATH:/usr/local/php/bin:/usr/local/php/sbin"

Source/etc/profile

Prepare the log file directory of PHP5:

Mkdir-p/usr/local/php/logs/php-fpm

Chown-R www-data: www-data/usr/local/php/logs/php-fpm

Prepare the PHP configuration file:

Cp-f php. ini-production/usr/local/php/etc/php. ini

Chmod 644/usr/local/php/etc/php. ini

Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

Note: The PHP5 configuration file in/usr/local/php/etc/php. ini, php-fpm configuration file in/usr/local/php/etc/php-fpm.conf.

Set the php-fpm startup management file and make PHP run automatically at ubuntu startup (the following sapi is in the PHP5.4.0 installation package ):

Cp-f sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm

Chmod 755/etc/init. d/php-fpm

Set startup

Update-rc.d-f php-fpm defaults

Vim/usr/local/php/etc/php. ini

Add error_log in php. ini

Error_log =/usr/local/php/logs/

Install PHP5.3

. /Configure-prefix =/usr/local/php-enable-fpm-with-fpm-user = www-data-with-fpm-group = www-data-with-curl- with-mcrypt-enable-mbstring-enable-pdo-with-pdo-mysql = mysqlnd-with-mysqli = mysqlnd-with-mysql = mysqlnd-with-openssl-with-imap- ssl-with-gd-with-jpeg-dir =/usr/lib/-with-png-dir =/usr/lib/-enable-exif-enable-zip

Make

Make install

Compile nginx by yourself

View nginx version and configuration information

Nginx-V

Configure Nginx

Apt-get install schedutils

Wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

Wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz

Aptitude install geoip-database

Groupadd www

Useradd-g www

Apt-get install libpcre3 libpcre3-dev openssl libssl-dev gcc automake make

Wget http://luajit.org/download/LuaJIT-2.0.0-beta9.tar.gz

Make & make install

Configuration file

./Configure-prefix =/usr/local/nginx-conf-path =/etc/nginx. conf-error-log-path =/Logs/nginx/error. log

-Http-client-body-temp-path =/Temps/nginx/body-http-fastcgi-temp-path =/Temps/nginx/fastcgi

-Http-log-path =/Logs/nginx/access. log-http-proxy-temp-path =/Temps/nginx/proxy

-Http-scgi-temp-path =/Temps/nginx/scgi-http-uwsgi-temp-path =/Temps/nginx/uwsgi-lock-path =/Locks/nginx. lock

-Pid-path =/Pids/nginx. pid-with-debug-with-http_addition_module-with-http_dav_module

-With-http_gzip_static_module-with-http_realip_module-with-http_stub_status_module

-With-http_ssl_module-with-http_sub_module-with-http_xslt_module-with-ipv6-with-sha1 =/usr/include/openssl

-With-md5 =/usr/include/openssl-with-mail-with-mail_ssl_module

-Add-module =/Packages/nginx_modules/ngx_devel_kit

-Add-module =/Packages/nginx_modules/lua-nginx-module

-Add-module =/Packages/nginx_modules/lua-resty-memcached

-Add-module =/Packages/nginx_modules/lua-resty-mysql

-Add-module =/Packages/nginx_modules/lua-resty-redis

With-http_image_filter_module

With-http_geoip_module

Make install

Install the Nginx extension module

1. Reconfigure with parameters:

./Configure-prefix =/app/nginx-user = nobody-group = nobody-with-http_stub_status_module

-With-http_ssl_module-with-http_realip_module

-Add-module = ../nginx_upstream_hash-0.3.1/

-Add-module = ../gnosek-nginx-upstream-fair-2131c73/

2. Compile:

Make

# Do not make install; otherwise, overwrite the installation.

3. Replace the nginx binary file:

Cp/app/nginx/sbin/nginx. bak

Cp./objs/nginx/app/nginx/sbin/

Third-party plug-ins of nginx

Http://wiki.nginx.org/3rdPartyModules

Log processing

Http://www.xmydlinux.org/201105/493.html startup configuration

Http://addcn.blogbus.com/logs/107131815.html script

Http://longzhiyi.blog.51cto.com/350171/822159 nginx processing cookie

Http://linuxcommand.org/man_pages/logrotate8.html log polling

Http://www.5ilinux.com/2011/12/nginx-logrotate.html detailed log polling configuration

What is the content of the nginx installation module?

Http://www.dewen.org/q/655/%E5%A6%82%E4%BD%95%E5%8D%95%E7%8B%AC%E6%B7%BB%E5%8A%A0nginx%E8%87%AA%E5% AE %9A%E4%B9%89%E6%A8%A1%E5%9D%97

LUA language

Http://blog.111cn.net/hong201/article/category/531338

Install the OpenResty suite. This time, we chose agentzh to do this, saving the trouble of the above configuration.

Apt-get install libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl

./Configure-with-luajit

Make

Make install

Installed in the/usr/local/openresty/directory by default.

If the configuration file in nginx. conf is incorrect, an error occurs. Unable to route

Install full-text retrieval coreseek/sphek

Wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz

Tar zxvf coreseek-4.1-beta.tar.gz

Cd mmseg-3.2.14

./Bootstrap # The output warning information can be ignored. If an error occurs, it must be resolved.

./Configure-prefix =/usr/local/mmseg3

Make & make install

Cd ..

# Install coreseek

Cd csft-4.1

Sh buildconf. sh # The output warning information can be ignored. If an error occurs, it must be resolved.

. /Configure-prefix =/usr/local/coreseek-without-unixodbc-with-mmseg-supported des =/usr/local/mmseg3/include/mmseg/-- mmseg-libs =/usr/local/mmseg3/lib/-with-mysql # if a mysql problem is prompted, you can view the MySQL data source installation instructions.

Make & make install

Cd ..

Compile and install the sphinxse engine of mysql 5.1:

1. Create the storage/sphse directory in the MySQL source code directory, and copy all the files in the mysqlse directory in the sphse source code directory to this directory. Example:

Mkdir-p/home/yangxinqi/down/mysql-5.1.57/storage/sphqi

Cp-R/home/yangxinqi/down/coreseek-4.1-beta/csft-4.1/mysqlse/*/home/yangxinqi/down/mysql-5.1.57/storage/sphinx

2. Run the command in the MySQL source code directory.

Sh BUILD/autorun. sh

3. configure MySQL to enable the Sphinx engine. prefix specifies the directory to which the installation is located.

./Configure-with-plugins = sphsf-prefix =/usr/local/mysql5004

4. build and install MySQL

Make

Make install

Compile and install the mysql 5.5 series sphinx engine

Cd mysql-5.5.25

Mkdir./storage/sphinx

Cp-r/home/ubuntu/down/coreseek-4.1-beta/csft-4.1/mysqlse/*./storage/sphse

Cmake.-DCMAKE_BUILD_TYPE = Release-DWITH_SPHINX_STORAGE_ENGINE = 1

Make

Cp storage/sphinx/ha_sphinx.so/usr/local/mysql/lib/plugin

Mysql-uroot-p

Mysql> install plugin sphpolicsoname "ha_sphinx.so ";

Mysql> show engines;

Install redis

1. Download and install Redis: cd/tmp

Wget http://redis.googlecode.com/files/redis-2.4.6.tar.gz

Tar-zxf redis-2.4.6.tar.gz

Cd redis-2.4.6

Make

Make PREFIX =/usr/local/redis install

Ln-s/usr/local/redis/bin/*/usr/bin

2. Configure init script: wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server

Wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf

Sudo mv redis-server/etc/init. d/redis-server

Sudo chmod + x/etc/init. d/redis-server

Sudo mv redis. conf/etc/redis. conf

3. Before initializing the user and log path, we recommend that you create a user for Redis and create a new data and log folder before starting Redis for the first time.

Sudo useradd redis

Sudo mkdir-p/var/lib/redis

Sudo mkdir-p/var/log/redis

Sudo chown redis. redis/var/lib/redis

Sudo chown redis. redis/var/log/redis

4, set the boot automatic startup, shutdown automatic shutdown update-rc.d redis-server ULTS

5. Start Redis:

/Etc/init. d/redis-server start

Install scws word segmentation

Wget http://www.ftphp.com/scws/down/scws-1.2.0.tar.bz2

Tar xvf scws-1.2.0.tar.bz2

./Configure-prefix =/usr/local/scws

Make

Make install

Install the php extension of scws

Cd phpext

Phpize

./Configure-with-php-config =/usr/local/php/bin/php-config

Make

Make install

Vim/usr/local/php/etc/php. ini

Extensiton = scws. so

Install phpredis

Wget https://github.com/nicolasff/phpredis/zipball/master

Unzip master

Cd nicolasff-phpredis-f1231c9

Phpize

./Configure-with-php-config =/usr/local/php/bin/php-config

Make & make install

Vim/usr/local/php/etc/php. ini

Extension = redis. so

Install phpunit

Cd/usr/local/php/bin # if it is not root, use sudo./pear ....

Pear channel-discover pear.phpunit.de

Pear channel-discover components. ez. no

Pear channel-discover pear.symfony-project.com

Pear install phpunit/PHPUnit

Install vim ide)

Http://code.google.com/p/vimide/wiki/GuideCn

Sudo apt-get install exuberant-ctags wget unzip

Svn checkout http://vimide.googlecode.com/svn/trunk/linux vimide

Cd vimide/

Sh install. sh

Vim/root/. vimrc

Map <silent> <F3> <ESC>: NERDTreeToggle <CR

FastDFS configuration

Find the location of libpthread. a during compilation errors.

/Usr/lib/x86_64-linux-gnu/libpthread.

Http://blog.111cn.net/chen861201/article/details/7341637

Find/-name 'libpthread. So'

/Usr/lib/x86_64-linux-gnu/libpthread. so

Follow the subsequent configuration

1. extension = fastdfs_client.so

2. fastdfs_client.tracker_group_count = 1

3. fastdfs_client.tracker_group0 =/etc/fdfs/client. conf

Modify the traceserver address in client. conf.

Http://code.google.com/p/fastdfs/

Here is what is supported

Http://bbs.chinaunix.net/forum.php? Mod = forumdisplay & fid = 240 & page = 1

You can directly deploy nginx + fastdfs for storage, which is very convenient.

Install memcached

Wget http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz

./Configure-prefix =/usr/local/memcached

/Usr/local/memcached/bin/memcached-m 64-p 11211-u ubuntu-l 127.0.0.1 &

Telnet fig 11211

 

Install php memcachd extension

Wget https://launchpad.net/libmemcached/1.0/1.0.6/+download/libmemcached-1.0.6.tar.gz

Sudo apt-get install libcloog-ppl0

Make & make install

Wget http://pecl.php.net/get/memcached-2.0.1.tgz

Tar zxvf memcached-2.0.1.tgz

Cd memcached-2.0.1

Phpize

./Configure-with-php-config =/usr/local/php/bin/php-config

Make

Make install

Vim/usr/local/php/etc/php. ini

Extension = memcached. so

/Etc/init. d/php-fpm restart

Memcat-servers = 127.0.0.1: 11211

The output is some statistical data of the memcached server.

Articles on maintenance tools

Install the ClusterShell server O & M tool

Sudo apt-get install clustershell

Http://huoding.com/2011/11/12/133

MYSQL high availability solution

Http://code.google.com/p/mysql-master-ha/

To enable system startup, you can add chkconfig or/etc/init. d/rc. local to enable automatic startup.

Disable ROOT, which makes it safer

Add ubuntu to root

Chmod u + w/etc/sudoers

Vim/etc/sudoers
Add
Loginusername ALL = (ALL) ALL
Chmod u-w/etc/sudoers
Disable root after completion

 

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.