LAMP + Xcache environment build _ MySQL

Source: Internet
Author: User
Tags mysql create
Build a LAMP + Xcache environment

I. Linux

Operating system: CentOS6.4

1. configure available yum sources

2. development environment support:

# Yum groupinstall-y "Development tools"

# Yum groupinstall-y "Server Platform Development"

Ubuntu13.04 install LAMP/Vsftpd/Webmin/phpMyAdmin services and settingsHttp://www.linuxidc.com/Linux/2013-06/86250.htm

Compile and install LAMP (Apache 2.2.44 + MySQL 5.6.10 + PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm in CentOS 5.9

Source code for Web server architecture under RedHat5.4 build the LAMP environment and application PHPWindhttp: // www.linuxidc.com/Linux/2012-10/72484p2.htm

Build a WEB server Linux + Apache + MySQL + PHPhttp in the LAMP source environment: // www.linuxidc.com/Linux/2013-05/84882.htm

II. Apache

Compile and install httpd-2.4.9

1. install pcre-devel (dependency package)

# Yum install pcre-devel-y

(About pcre: http://www.linuxidc.com/Linux/2014-04/99536.htm)

# Tar-xf apr-1.5.0.tar.bz2-C/usr/src/

# Apr-1.5.0/cd/usr/src/

#./Configure -- prefix =/usr/local/apr // specify the installation location

# Make & make install

(About apr: http://zh.wikipedia.org/wiki/Apache%E5%8F%AF%E7%A7%BB%E6%A4%8D%E8%BF%90%E8%A1%8C%E6%97%B6)

# Tar-xf apr-util-1.5.3.tar.bz2-C/usr/src/

# Apr-util-1.5.3/cd/usr/src/

#./Configure -- prefix =/usr/local/apr-util -- with-apr =/usr/local/apr

# Make & make install

# Tar-xf httpd-2.4.9.tar.bz2-C/usr/src

# Httpd-2.4.9/cd/usr/src/

#. /Configure -- prefix =/usr/local/apache -- sysconfdir =/etc/httpd -- enable-so -- enable-ssl -- enable-cgi -- enable-rewrite -- with-zlib -- -pcre -- with-apr =/usr/local/apr -- with-apr-util =/usr/local/apr-util -- enable-modules = most -- enable-mpms-shared = most -- with-mpm = event

========================================================== ======================================

Meaning:

-- Prefix =/usr/local/apache # → specify the installation location

-- Sysconfdir =/etc/httpd # → specify the configuration file installation location

-- Enable-so # → enable DSO-based dynamic module loading

-- Enable-ssl # → enable https-based functions

-- Enable-cgi # → enable cgi-based functions

-- Enable-rewrite # → enable the function that supports URL rewriting

-- With-zlib # → specify the API used to compress a common compressed Library when data packets are sent over the Internet

-- With-pcre # → specify cgi that supports poll

-- With-apr =/usr/local/apr # → specify the installation path of the par

-- With-apr-util =/usr/local/apr-util/# → specify the installation path of par-util

-- Enable-modules = most # → enable most common modules

-- Enable-mpms-shared = all # → enable loading of all mpm modules

-- With-mpm = event # → specify that the next httpd working mode is event

========================================================== ====================================

# Make & make install


A). static: use -- with-mpm = to specify the module name. Once the compilation and installation are complete, the module cannot be uninstalled and can only be re-compiled and installed.

B). dynamic: Use the -- enable-mpms-shared option to enable this feature. When the given parameter is all, all MPM modules supported by this platform will be installed. During runtime loading, building MPM as a dynamic module allows you to modify the content of the LoadModule command to change MPM without re-compiling and installation.

Configuration:

A) set the path of the pid file:

# Vim/etc/httpd. conf // add

PidFile "/var/run/httpd. pid"

# Vim/etc/rc. d/init. d/httpd // modify

Apachectl =/usr/local/apache/bin/apachectl

Httpd =$ {HTTPD-/usr/local/apache/bin/httpd}

# Chmod + x/etc/rc. d/init. d/httpd

# Chkconfig -- add httpd

# Chkconfig -- list httpd

Httpd 0: off 1: off 2: off 3: off 4: off 5: off 6: off

# Chkconfig httpd on

# Chkconfig -- list httpd

Httpd 0: off 1: off 2: on 3: on 4: on 5: on 6: off

# Service httpd start

# Ps-elFH

III. MySQL

1. install

# Tar xf mysql-5.5.33-linux2.6-x86_64.tar.gz-C/usr/local

# Ln-sv/usr/local/mysql-5.5.33-linux2.6-x86_64 mysql create soft connection, easy to operate

# Fdisk/dev/sda // 10G

# Pvcreate/dev/sda3 // create a physical volume

# Vgcreate myvg/dev/sda8 // Create a volume Group

# Lvcreate-L 8G-n mydata myvg // create a logical volume

# Mke2fs-t ext4/dev/myvg/mydata // format the logical volume

# Mkdir/mydata // create a logical volume mount Directory

# Mkdri-pv/mydata/data // Create a mysql data storage directory

# Vim/etc/fstab // add automatic mounting upon startup

/Dev/myvg/mydata ext4 defaults 0 0

# Mount-a // mount

3. create a user to run the process safely

# Groupadd-r mysql // create a system Group mysql

# Useradd-r-s/sbin/nologin-g mysql-M-D/mydata/data mysql

// Create a system user mysql

# Chown-R mysql: mysql/mydata/data

// Set the directory owner group

4. initialize mysql

# Cd/usr/local/mysql

# Scripts/mysql_install_db -- datadir =/mydata/data -- user = mysql

// Initialize the database

# Chown-R root.

// Set the owner of all files in the current directory to root.

5. provide scripts

# Cd/usr/local/mysql

# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld

// Set the script mysqld

# Chmod + x/etc/rc. d/init. d/mysqld

// Grant the script execution permission

# Chkconfig -- add mysqld

// Add boot start

# Chkconfig mysqld on

6. provide configuration files

# Cd/usr/local/mysql

# Cp support-files/my-large.cnf/etc/my. cnf

# Vim/etc/my. cnf

Thread_concurrency = 2

// Modify the number of concurrent threads. the bithread_concurrency value is the number of CPUs multiplied by 2.

Datadir =/mydata/data

# Add, mysql data file storage path:

7. other configurations

# Vim/etc/profile. d/mysqld. sh

Export PATH =/usr/local/mysql/bin: $ PATH

# Source/etc/profile. d/mysqld. sh

# Vim/etc/man. config

MANPATH/usr/local/mysql/man // add this row

# Ln-sv/usr/local/mysql/include/usr/include/mysql

// Output the mysql header file to the system header file path/usr/include

# Echo '/usr/local/mysql/lib'>/etc/ld. so. conf. d/mysql. conf

// Output the mysql database file to the system database

# Ldconfig // reload the system Library:

# Service mysqld start

# Ss-rnl | grep 3306

# Mysql

Mysql> use mysql

Mysql> select host, user, password from user;

Mysql> delete from user WHERE user = ''; // DELETE an empty user

Mysql> delete from user WHERE user = ': 1'; // DELETE an ipv6 user

Mysql> UPDATE user SET password = PASSWORD ('hoolie') WHERE password = '';

// Set the password for the root user

Mysql> flush privileges;

For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2014-05/10187p2.htm

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.