標籤:mariadb wordpress
---- LAMP ==> Linux Apache Mariadb PHP
-----安裝前準備工作:
yum -y install gcc gcc-c++ zlib libxml2-devel libxml2 libmcrypt libmcrypt-devel libltdl libltdl-devel libpng libpng-devel freetype autoconf gd gd-devel ncurses*--install jpegwget http://www.ijg.org/files/jpegsrc.v9a.tar.gztar -zxvf jpegsrc.v9a.tar.gzcd jpeg-9a/./configure --prefix=/data/server/jpegmakemake install
------------ 安裝 Mariadb
建立Mariadb運行帳號:
groupadd mysqluseradd mysql -g mysql
要編譯mariadb需要用到cmake
yum -y install cmake
如果沒有,則到官網下載最新的:http://www.cmake.org/
tar xf cmake-x.x.tar.gzcd cmake-x.x./bootstrapmake && make install
1.源碼安裝:
wget http://mirror.mephi.ru/mariadb/mariadb-10.0.14/source/mariadb-10.0.14.tar.gztar -zxvf mariadb-10.0.14.tar.gzcd mariadb-10.0.14cmake . -DCMAKE_INSTALL_PREFIX=/data/server/mariadb -DMYSQL_DATADIR=/data/mariadb -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_SSL=system make && make install
2.yum安裝:
該檔案的內容是參考官網,並從官網上產生的,設定安裝源倉庫的 具體的地址為:
https://downloads.mariadb.org/mariadb/repositories/
將下面代碼添加到yum源中:
# MariaDB 10.1 CentOS repository list - created 2014-12-03 03:10 UTC# http://mariadb.org/mariadb/repositories/[mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.1/centos6-x86gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=1
yum -y install MariaDB-server MariaDB-clientservice mysql startmysql -uroot -p# 預設密碼為空白
[[email protected] ~]# mysql -uroot -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 3Server version: 10.1.0-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, SkySQL Ab and others.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.MariaDB [(none)]> MariaDB [(none)]> MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+4 rows in set (0.00 sec)MariaDB [(none)]> MariaDB [(none)]> status;--------------mysql Ver 15.1 Distrib 10.1.0-MariaDB, for Linux (i686) using readline 5.1Connection id: 7Current database:Current user: [email protected]SSL: Not in useCurrent pager: stdoutUsing outfile: ‘‘Using delimiter: ;Server: MariaDBServer version: 10.1.0-MariaDB MariaDB ServerProtocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: utf8Conn. characterset: utf8UNIX socket: /var/lib/mysql/mysql.sockUptime: 7 min 56 secThreads: 1 Questions: 20 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 26 Queries per second avg: 0.042--------------
修改root密碼:
mysqladmin -u root password ‘test123‘
修改資料存放目錄:
service mysql stop
建立新的db目錄:
mkdir /data/mariadb
拷貝預設資料庫到新的位置:
cp -a /var/lib/mysql /data/mariadb
備份原來的設定檔:
cp -a /etc/my.cnf /etc/my.cnf_bak # 該檔案裡面只是一條包含語句,真正要備份的是下面這個檔案:cp /etc/my.cnf.d/server.cnf /etc/my.cnf.d/server.cnf_bak
cat /etc/my.cnf.d/server.cnf |grep -v ^#[server][mysqld]datadir = /data/mariadb/mysqlsocket = /var/lib/mysql/mysql.sock character_set_server = utf8 [embedded][mariadb][mariadb-10.1]service mysql start #啟動Mariadb
------------ 安裝Apache
wget http://apache.communilink.net//httpd/httpd-2.4.10.tar.bz2
wget http://ftp.cuhk.edu.hk/pub/packages/apache.org//apr/apr-1.5.1.tar.bz2
wget http://ftp.cuhk.edu.hk/pub/packages/apache.org//apr/apr-util-1.5.4.tar.bz2
tar -jxf apr-1.5.1.tar.bz2cd apr-1.5.1./configure --prefix=/data/server/apr --disable-ipv6make && make installtar -jxf apr-util-1.5.4.tar.bz2cd apr-util-1.5.4./configure --prefix=/data/server/apr-util --with-apr=/data/server/aprmake && make installtar -jxf httpd-2.4.10.tar.bz2cd httpd-2.4.10./configure --prefix=/data/server/apache --enable-http --enable-ssl --enable-vhost-alias --enable-rewrite --with-apr=/data/server/apr --with-apr-util=/data/server/apr-utilmakemake install
測試:
[[email protected] opt]# curl http://127.0.0.1/<html><body><h1>It works!</h1></body></html>
----------- 安裝PHP
wget http://hk1.php.net/distributions/php-5.6.3.tar.bz2tar -jxf php-5.6.3.tar.bz2cd php-5.6.3./configure --prefix=/data/server/php --with-apxs2=/data/server/apache/bin/apxs --disable-ipv6 --with-zlib --with-gd --with-jpeg-dir=/data/server/jpeg --with-png-dir --with-zlib-dir --with-freetype-dir --with-mysql --with-mysqli --enable-embedded-mysqli --enable-zip --enable-mysqlnd --with-gdmakemake installcp ./php.ini-production /data/server/php/lib/php.ini
修改php預設時區:
vim /data/server/php/lib/php.inidate.timezone = Asia/Shanghai # 去掉該參數注釋,並設定時區為亞洲上海
修改apache設定檔,使其可以解析php程式:
AddType application/x-httpd-php .php# 在相應的地方添加該行<IfModule dir_module>DirectoryIndex index.html index.php# 添加:index.php</IfModule>LoadModule php5_module modules/libphp5.so# 一般預設會添加,如果沒有,自己手動添加到相應地方
----- 建立資料庫:
MariaDB [(none)]> create database wordpress;MariaDB [(none)]> grant all privileges on wordpress.* to [email protected]‘localhost‘ identified by "[email protected]" with grant option ;MariaDB [(none)]> flush privileges;
----- 建立wordpress
wget https://cn.wordpress.org/wordpress-4.0.1-zh_CN.tar.gztar -zxf wordpress-4.0.1-zh_CN.tar.gzcp -ar wordpress /data/www/
http://localhost/wordpress/wp-admin
填寫好資料庫資訊,提交,2分鐘OK
本文出自 “蟲子” 部落格,請務必保留此出處http://chongzi100.blog.51cto.com/340243/1591485
CentOS6.4+Apache+Mariadb+PHP搭建WordPress