(第十二周作业)
1、编译安装搭建wordpress
Centos 7.2编译安装LAMP实现WordPress个人博客搭建
(1)设置光盘yum源,yum安装基础软件环境
# mkdir /mnt/cdrom
# mount /dev/sr0 /mnt/cdrom
# cd /etc/yum.repos.d/
# mkdir bak
# mv /etc/yum.repos.d/*.repo bak
# vi /etc/yum.repos.d/CentOS-Local.repo
[Local]
name=LocalYum
baseurl=file:///mnt/cdrom
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7
enabled=1
# yum groupinstall "development tools"
# yum install openssl-devel expat-devel pcre-devel
(2)下载全部软件安装包
从 http://apr.apache.org/下载
apr-1.6.5.tar.gz
apr-util-1.6.1.tar.gz
从 http://httpd.apache.org/下载
httpd-2.4.38.tar.gz
从http://php.net/下载
php-7.1.26.tar.gz
从 http://mariadb.org/下载
mariadb-10.3.12-linux-x86_64.tar
从https://cn.wordpress.org/下载
wordpress-5.0.3-zh_CN.tar.gz
(3)安装httpd
#useradd web
# su - web
(web)$ mkdir soft
上传apr-1.6.5.tar.gz 和apr-util-1.6.1.tar.gz 、 httpd-2.4.38.tar.gz到 /home/web/soft目录下
(web)$ tar xvf apr-1.6.5.tar.gz
(web)$ tar xvf apr-util-1.6.1.tar.gz
(web)$ tar xvf httpd-2.4.38.tar.gz
(web)$ cp -r apr-1.6.5 httpd-2.4.38/srclib/apr
(web)$ cp -r apr-util-1.6.1 httpd-2.4.38/srclib/apr-util
(web)$ mkdir /home/web/app
(web)$ cd /home/web/soft/httpd-2.4.38
(web)$ ./configure --prefix=/home/web/app/httpd24 --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
(web)$ make -j 4
(web)$ make install
修改httpd端口为8080
(web)$ vi /home/web/app/httpd24/conf/httpd.conf 修改以下行为以下内容
Listen 8080
User web
Group web
(web)$ vi /home/web/.bash_profile 最后增加一行内容
export PATH=$PATH:/home/web/app/httpd24/bin
(web)$ source /home/web/.bash_profile
(web)$ apachectl start 启动httpd
(web)$ ss -lnt查看8080端口是否监听
(4)安装mariadb
# useradd mysql
#yum install libaio
# su - mysql
(mysql)$ mkdir /home/mysql/{soft,mysqlData,conf}
上传mariadb-10.3.12-linux-x86_64.tar到/home/mysql/soft目录下
(mysql)$ cd soft
(mysql)$ tar -zxf mariadb-10.3.12-linux-x86_64.tar.gz
(mysql)$ ln -s mariadb-10.3.12-linux-x86_64 mysql
(mysql)$ cd mysql/scripts/
(mysql)$ ./mysql_install_db --basedir=/home/mysql/soft/mysql --datadir=/home/mysql/mysqlData --user=mysql
(mysql)$ vi /home/mysql/conf/my.cnf
[client]
port=3306
socket=/tmp/mysql.sock
[mysqld]
port=3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 128K
datadir=/home/mysql/mysqlData
server-id = 1
lower_case_table_names=1
character_set_server = utf8
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout
(mysql)$ cd /home/mysql/soft/mysql
(mysql)$./bin/mysqld_safe --defaults-file=/home/mysql/conf/my.cnf &
(mysql)$ cd /home/mysql/soft/mysql/bin
(mysql)$ ./mysqladmin -uroot password "admin"
(mysql)$ mysql -uroot -padmin
mysql>create datebase wpdb;
mysql>grant all on wpdb.* to wpuser@'192.168.184.%' identified by 'wpuser';
mysql>grant all on wpdb.* to wpuser@'127.%' identified by 'wpuser';
mysql>grant all on wpdb.* to wpuser@'localhost' identified by 'wpuser';
mysql>quit;
(mysql)$ vi ~/.bash_profile
export PATH=$PATH:/home/mysql/soft/mysql/bin
(5)安装php
(web)$ yum install libxml2-devel bzip2-devel
(web)$ yum install -y epel-release
(web)$ yum install -y libmcrypt-devel
上传php-7.1.26.tar.gz到/home/web/soft
(web)$ tar xvf php-7.1.26.tar.gz
(web)$cd php-7.1.26
(web)$ ./configure --prefix=/home/web/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/home/web/app/httpd24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-maintainer-zts --disable-fileinfo
(web)$ make -j 4
(web)$ make install
su - root
# cp /home/web/soft/php-7.1.26/php.ini-production /etc/php.ini
# vi /home/web/app/httpd24/conf/httpd.conf
在文件尾部加两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
修改下面行
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
重启apache
(web)$ apachectl stop
(web)$ apachectl start
(6)安装wordPress
上传wordpress-5.0.3-zh_CN.tar.gz到/home/web/soft
(web)$ tar -xvf wordpress-5.0.3-zh_CN.tar.gz -C /home/web/app/httpd24/htdocs
(web)$ cd /home/web/app/httpd24/htdocs/
(web)$ mv wordpress/ blog/
(web)$cd blog/
(web)$ cp wp-config-sample.php wp-config.php
(web)$ vi wp-config.php
/** WordPress数据库的名称 */
define('DB_NAME', 'wpdb');
/** MySQL数据库用户名 */
define('DB_USER', 'wpuser');
/** MySQL数据库密码 */
define('DB_PASSWORD', 'wpuser');
/** MySQL主机 */
define('DB_HOST', 'localhost');
(7)关闭防火墙,登录测试
# service firewalld stop
在外部机器上的IE地址栏输入 :http://192.168.184.147:8080/blog
wordPress 搭建完成。
2、搭建php-admin
phpAdmin是使用浏览器进行管理MySql数据库
可以利用之前搭建的apache 、mysql、 php环境
从www.phpmyadmin.net下载phpMyAdmin-4.8.5-all-languages.zip
上传 到/home/web/soft
(web)$ cd /home/web/soft
(web)$ mv phpMyAdmin-4.8.5-all-languages.zip /home/web/app/httpd24/htdocs
(web)$ unzip phpMyAdmin-4.8.5-all-languages.zip
(web)$ phpMyAdmin-4.8.5-all-languages/ phpMyadmin
(web)$ cd phpMyadmin/
(web)$ cp config.sample.inc.php config.inc.php
访问phpMyAdmin的web管理界面域名后缀加/phpMyadmin访问
http://192.168.184.147:8080/phpMyadmin/,然后就可以像Navicat一个管理mysql了。
网友评论