centos7.3 编译安装lamp,利用wordpress实现个人博客搭建

软件环境:centos7.3

软件包:

apr-1.5.2.tar.bz2

apr-util-1.5.4.tar.bz2

httpd-2.4.27.tar.bz2

mariadb-10.2.7-linux-x86_64.tar.gz

php-7.1.7.tar.bz2

wordpress-4.8-zh_CN.tar.gz

xcache-3.2.0.tar.gz


准备工作:

[root@he~]#mkdir/app#创建/app目录,我们把软件包安装到/app里
[root@he~]#mkdirdata#创建data文件夹,把我们下载的软件包传入
[root@he~]#ls
data
[root@he~]#cddata/
[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#rz

[root@hedata]#ls#显示我们所有的软件包
apr-1.5.2.tar.bz2httpd-2.4.27.tar.bz2php-7.1.7.tar.bz2xcache-3.2.0.tar.gz
apr-util-1.5.4.tar.bz2mariadb-10.2.7-linux-x86_64.tar.gzwordpress-4.8-zh_CN.tar.gz
[root@he~]#yum-ygroupinstall'developmenttools'#提前安装开发包组
Loadedplugins:fastestmirror
Thereisnoinstalledgroupsfile.
Mayberun:yumgroupsmarkconvert(seemanyum)
base
…………
DependencyInstalled:
apr.x86_640:1.4.8-3.el7apr-util.x86_640:1.5.2-6.el7
boost-system.x86_640:1.53.0-26.el7boost-thread.x86_640:1.53.0-26.el7
bzip2.x86_640:1.0.6-13.el7dwz.x86_640:0.11-3.el7
dyninst.x86_640:8.2.0-2.el7emacs-filesystem.noarch1:24.3-19.el7_3
gdb.x86_640:7.6.1-94.el7gettext-common-devel.noarch0:0.18.2.1-4.el7
gettext-devel.x86_640:0.18.2.1-4.el7kernel-devel.x86_640:3.10.0-514.26.2.el7
libdwarf.x86_640:20130207-4.el7libgfortran.x86_640:4.8.5-11.el7
libgnome-keyring.x86_640:3.8.0-3.el7libquadmath.x86_640:4.8.5-11.el7
libquadmath-devel.x86_640:4.8.5-11.el7libstdc++-devel.x86_640:4.8.5-11.el7
mokutil.x86_640:0.9-2.el7neon.x86_640:0.30.0-3.el7
pakchois.x86_640:0.4-10.el7perl-Data-Dumper.x86_640:2.145-3.el7
perl-Error.noarch1:0.17020-2.el7perl-Git.noarch0:1.8.3.1-6.el7_2.1
perl-TermReadKey.x86_640:2.30-20.el7perl-Test-Harness.noarch0:3.28-3.el7
perl-Thread-Queue.noarch0:3.02-2.el7perl-XML-Parser.x86_640:2.41-10.el7
perl-srpm-macros.noarch0:1-8.el7rsync.x86_640:3.0.9-17.el7
subversion-libs.x86_640:1.7.14-10.el7systemtap-client.x86_640:3.0-7.el7
systemtap-devel.x86_640:3.0-7.el7systemtap-runtime.x86_640:3.0-7.el7
unzip.x86_640:6.0-16.el7zip.x86_640:3.0-11.el7

Complete!
[root@he~]#yumremove-yapr#上面包组有老版的apr,可以卸载了
Loadedplugins:fastestmirror
ResolvingDependencies
-->Runningtransactioncheck
--->Packageapr.x86_640:1.4.8-3.el7willbeerased
…………
Removed:
apr.x86_640:1.4.8-3.el7

DependencyRemoved:
apr-util.x86_640:1.5.2-6.el7subversion.x86_640:1.7.14-10.el7subversion-libs.x86_640:1.7.14-10.el7

Complete!
[root@he~]#yuminstallpcre-developenssl-devel#安装需要的包
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
ResolvingDependencies
-->Runningtransactioncheck
…………
Installed:
openssl-devel.x86_641:1.0.1e-60.el7_3.1pcre-devel.x86_640:8.32-15.el7_2.1

DependencyInstalled:
keyutils-libs-devel.x86_640:1.5.8-3.el7krb5-devel.x86_640:1.14.1-27.el7_3libcom_err-devel.x86_640:1.42.9-9.el7
libkadm5.x86_640:1.14.1-27.el7_3libselinux-devel.x86_640:2.5-6.el7libsepol-devel.x86_640:2.5-6.el7
libverto-devel.x86_640:0.2.5-4.el7zlib-devel.x86_640:1.2.7-17.el7

Complete!


1、httpd2.4.27编译安装


[root@hedata]#tarxfapr-1.5.2.tar.bz2#解压文件
[root@hedata]#tarxfapr-util-1.5.4.tar.bz2
[root@hedata]#tarxfhttpd-2.4.27.tar.bz2
[root@hedata]#mvapr-1.5.2httpd-2.4.27/srclib/apr#将apr的文件放进httpd文件夹里面一起安装
[root@hedata]#mvapr-util-1.5.4httpd-2.4.27/srclib/apr-util
[root@hedata]#cdhttpd-2.4.27
[root@hehttpd-2.4.27]#./configure--prefix=/app/httpd24--enable-so--enable-ssl--enable-cgi--enable-rewrite--with-zlib
--with-pcre--with-included-apr--enable-modules=most--enable-mpms-shared=all--with-mpm=prefork#自定义安装的一些设置
……
config.status:executingdefaultcommands
configure:summaryofbuildoptions:

ServerVersion:2.4.27
Installprefix:/app/httpd24
Ccompiler:gcc-std=gnu99
CFLAGS:-g-O2-pthread
LDFLAGS:
LIBS:
CPPFLAGS:-DLINUX-D_REENTRANT-D_GNU_SOURCE
Cpreprocessor:gcc-E

[root@hehttpd-2.4.27]#make&&makeinstall#正式安装
…………
Installingconfigurationfiles
mkdir/app/httpd24/conf
mkdir/app/httpd24/conf/extra
mkdir/app/httpd24/conf/original
mkdir/app/httpd24/conf/original/extra
InstallingHTMLdocuments
mkdir/app/httpd24/htdocs
Installingerrordocuments
mkdir/app/httpd24/error
Installingicons
mkdir/app/httpd24/icons
mkdir/app/httpd24/logs
InstallingCGIs
mkdir/app/httpd24/cgi-bin
Installingheaderfiles
Installingbuildsystemfiles
Installingmanpagesandonlinemanual
mkdir/app/httpd24/man
mkdir/app/httpd24/man/man1
mkdir/app/httpd24/man/man8
mkdir/app/httpd24/manual
make[1]:Leavingdirectory`/root/data/httpd-2.4.27'
[root@he~]#vim/etc/profile.d/app.sh#写一个脚本,把httpd、mariadb放进bin下

exportPATH=/app/httpd24/bin:/usr/local/mysql/bin:$PATH

[root@hehttpd-2.4.27]#./etc/profile.d/app.sh#执行一下
[root@hehttpd-2.4.27]#ss-ntl#查看80端口对否开启
StateRecv-QSend-QLocalAddress:PortPeerAddress:Port
LISTEN0128*:22*:*
[root@hehttpd-2.4.27]#apachectl#用apache自带的程序启动
AH00558:httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1.Setthe'ServerName'directivegloballytosuppressthismessage
[root@hemysql]#ss-ntl#确认服务启动成功
StateRecv-QSend-QLocalAddress:PortPeerAddress:Port
LISTEN0128*:80*:*
LISTEN0128*:22*:*
LISTEN080*:22*:*
[root@hehttpd-2.4.27]#curl39.108.126.131#用字符浏览器看一下,这样就ok啦
<html><body><h1>Itworks!</h1></body></html>

注解:
AH00558:这个只是一个提示,算不上报错
在配置文件/app/httpd24/conf/httpd.conf里面改一下ServerNamelocalhost:80重启就不会有了


2、二进制安装mariadb

[root@hedata]#rpm-qa'mariadb*'#检查是否存在旧版本
mariadb-libs-5.5.52-1.el7.x86_64
[root@hedata]#yumremovemariadb-libs#删除旧版本
Loadedplugins:fastestmirror
ResolvingDependencies
-->Runningtransactioncheck
--->Packagemariadb-libs.x86_641:5.5.52-1.el7willbeerased
…………
Removed:
mariadb-libs.x86_641:5.5.52-1.el7

DependencyRemoved:
postfix.x86_642:2.10.1-6.el7redhat-lsb-core.x86_640:4.1-27.el7.centos.1

Complete!
[root@hebin]#cd/root/data#进入存放软件包的文件夹
[root@hedata]#ls
apr-1.5.2.tar.bz2httpd-2.4.27mariadb-10.2.7-linux-x86_64.tar.gzwordpress-4.8-zh_CN.tar.gz
apr-util-1.5.4.tar.bz2httpd-2.4.27.tar.bz2php-7.1.7.tar.bz2xcache-3.2.0.tar.gz
[root@hedata]#tarxfmariadb-10.2.7-linux-x86_64.tar.gz-C/usr/local/#解压到/usr/local
[root@hedata]#cd/usr/local/#进入解压数据库的文件夹
[root@helocal]#ls
aegisbinetcgamesincludeliblib64libexecmariadb-10.2.7-linux-x86_64sbinsharesrc
[root@helocal]#ln-smariadb-10.2.7-linux-x86_64/mysql#写个软连接
[root@helocal]#useradd-rmysql-s/sbin/nologin-d/app/mysqldb-m#创建mysql用户并指定家目录
[root@helocal]#cdmysql/
[root@hemysql]#scripts/mysql_install_db--user=mysql--datadir=/app/mysqldb/#运行生成数据库的脚本
InstallingMariaDB/MySQLsystemtablesin'/app/mysqldb/'...
…………
Thelatestinformationaboutmysql_install_dbisavailableat
https://mariadb.com/kb/en/installing-system-tables-mysql_install_db
MariaDBishostedonlaunchpad;Youcanfindthelatestsourceand
emaillistsathttp://launchpad.net/maria

Pleasecheckalloftheabovebeforesubmittingabugreport
at
[root@hemysql]#mkdir/etc/mysql#创建配置目录
[root@hemysql]#cpsupport-files/my-huge.cnf/etc/mysql/my.cnf#复制自带的配置模板
[root@hemysql]#vim/etc/mysql/my.cnf#修改模板
……
#TheMySQLserver
[mysqld]
datadir=/app/mysqldb#存放位置
innodb_file_per_table=ON
skip_name_resolve=ON
port=3306
……
[root@hemysql]#cpsupport-files/mysql.server/etc/init.d/mysqld#复制启动服务模板
[root@hemysql]#chkconfig--addmysqld#加入启动项
[root@hemysql]#chkconfig--listmysqld#查看启动项

Note:ThisoutputshowsSysVservicesonlyanddoesnotincludenative
systemdservices.SysVconfigurationdatamightbeoverriddenbynative
systemdconfiguration.

Ifyouwanttolistsystemdservicesuse'systemctllist-unit-files'.
Toseeservicesenabledonparticulartargetuse
'systemctllist-dependencies[target]'.

mysqld	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@hemysql]#servicemysqldstart#启动的时候如果失败检查/etc/mysql/my.cnf路径有没写错,可以参考/app/mysqldb/主机名.err文件排错
Startingmysqld(viasystemctl):Jobformysqld.servicefailedbecausethecontrolprocessexitedwitherrorcode.See"systemctlstatusmysqld.service"and"journalctl-xe"fordetails.
[FAILED]
[root@hemysql]#servicemysqldstart#启动服务,
Startingmysqld(viasystemctl):[OK]
[root@hemysql]#ss-ntl#确认服务启动成功
StateRecv-QSend-QLocalAddress:PortPeerAddress:Port
LISTEN0128*:80*:*
LISTEN0128*:22*:*
LISTEN080:::3306:::*
[root@hemysql]#mysql_secure_installation#执行mariadb自带的脚本配置安全选项

NOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMariaDB
SERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!

InordertologintoMariaDBtosecureit,we'llneedthecurrent
passwordfortherootuser.Ifyou'vejustinstalledMariaDB,and
youhaven'tsettherootpasswordyet,thepasswordwillbeblank,soyoushouldjustpressenterhere.

Entercurrentpasswordforroot(enterfornone):#根据提示完成下列选项
OK,successfullyusedpassword,movingon...

SettingtherootpasswordensuresthatnobodycanlogintotheMariaDB
rootuserwithouttheproperauthorisation.
……
Reloadprivilegetablesnow?[Y/n]y
...Success!

Cleaningup...

Alldone!Ifyou'vecompletedalloftheabovesteps,yourMariaDB
installationshouldnowbesecure.

ThanksforusingMariaDB!
[root@hemysql]#mysql-uroot-pXXXXX#登录mariadb
WelcometotheMariaDBmonitor.Commandsendwith;or\g.
YourMariaDBconnectionidis17
Serverversion:10.2.7-MariaDB-logMariaDBServer

Copyright(c)2000,2017,Oracle,MariaDBCorporationAbandothers.

Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.

MariaDB[(none)]>createdatabasewpdb;#创建数据库
QueryOK,1rowaffected(0.00sec)

MariaDB[(none)]>grantallonwpdb.*tousername@'%'identifiedby'XXXXX.';#创建新的用户和密码并分配权限
QueryOK,0rowsaffected(0.00sec)

MariaDB[(none)]>exit#退出
Bye

3、编译安装php

[root@hemysql]#cd/root/data/#进入放软件包的文件夹
[root@hedata]#tarxfphp-7.1.7.tar.bz2#解压文件
[root@hedata]#cdphp-7.1.7
[root@hephp-7.1.7]#yum-yinstalllibxml2-develbzip-devellibmcrypt-develbzip2-deve#安装需要的包
…………
Verifying:libxml2-devel-2.9.1-6.el7_2.3.x86_644/4

Installed:
libmcrypt-devel.x86_640:2.5.8-13.el7libxml2-devel.x86_640:2.9.1-6.el7_2.3

DependencyInstalled:
libmcrypt.x86_640:2.5.8-13.el7xz-devel.x86_640:5.2.2-1.el7

Complete!
[root@hephp-7.1.7]#./configure--prefix=/app/php--enable-mysqlnd--with-mysqli=mysqlnd--with-openssl--enable-mbstring--with-png-dir--with-jpeg-dir--with-freetype-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/app/httpd24/bin/apxs--with-mcrypt--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d--with-bz2
checkingforgrepthathandleslonglinesand-e.../usr/bin/grep#自定义一些模块的设置
checkingforegrep.../usr/bin/grep-E
checkingforasedthatdoesnottruncateoutput.../usr/bin/sed
…………
ThankyouforusingPHP.

config.status:creatingphp7.spec
config.status:creatingmain/build-defs.h
config.status:creatingscripts/phpize
config.status:creatingscripts/man1/phpize.1
config.status:creatingscripts/php-config
config.status:creatingscripts/man1/php-config.1
config.status:creatingsapi/cli/php.1
config.status:creatingsapi/cgi/php-cgi.1
config.status:creatingext/phar/phar.1
config.status:creatingext/phar/phar.phar.1
config.status:creatingmain/php_config.h
config.status:executingdefaultcommands
[root@hephp-7.1.7]#make&&makeinstall#编译安装
…………
InstallingPEARenvironment:/app/php/lib/php/
[PEAR]Archive_Tar-installed:1.4.3
[PEAR]Console_Getopt-installed:1.4.1
[PEAR]Structures_Graph-installed:1.1.1
[PEAR]XML_Util-installed:1.4.2
[PEAR]PEAR-installed:1.10.5
WrotePEARsystemconfigfileat:/app/php/etc/pear.conf
Youmaywanttoadd:/app/php/lib/phptoyourphp.iniinclude_path
/root/data/php-7.1.7/build/shtoolinstall-cext/phar/phar.phar/app/php/bin
ln-s-fphar.phar/app/php/bin/phar
InstallingPDOheaders:/app/php/include/php/ext/pdo/
[root@hephp-7.1.7]#cpphp.ini-production/etc/php.ini#复制一份配置文件去修改
[root@hephp-7.1.7]#vim/app/httpd24/conf/httpd.conf#修改apache的配置文件,允许php文件
……
AddTypeapplication/x-compress.Z
AddTypeapplication/x-gzip.gz.tgz
AddTypeapplication/x-httpd-php.php
AddTypeapplication/x-httpd-php-source.phps
……
<IfModuledir_module>
DirectoryIndexindex.phpindex.html
</IfModule>
[root@hephp-7.1.7]#apachectlstop#关闭服务
[root@hephp-7.1.7]#apachectlstart#启动服务

4、测试连接

[root@hephp-7.1.7]#vim/app/httpd24/htdocs/index.php#写一个测试数据库是否联通的小文件

<?php
$mysqli=newmysqli("127.0.0.1","root","XXXXX");
if(mysqli_connect_errno()){
echo"连接数据库失败!";
$mysqli=null;
exit;
}
echo"连接数据库成功!";
$mysqli->close();
?>

5、解压WordPress、根据提示做一下基本的配置

[root@he~]#cd/root/data/#进入放软件包的文件夹
[root@hedata]#tarxfwordpress-4.8-zh_CN.tar.gz#解压WordPress
[root@hedata]#mvwordpress/app/httpd24/htdocs/blog#把WordPress移动到apache目录下并更名blog
[root@hedata]#cd/app/httpd24/htdocs/blog/#进入blog
[root@heblog]#cpwp-config-sample.phpwp-config.php#复制一份配置文件来修改
[root@heblog]#vimwp-config.php#修改配置文件,根据中文提示
……
//**MySQL设置-具体信息来自您正在使用的主机**//
/**WordPress数据库的名称*/
define('DB_NAME','wpdb');

/**MySQL数据库用户名*/
define('DB_USER','root');

/**MySQL数据库密码*/
define('DB_PASSWORD','XXXXXX');

/**MySQL主机*/
define('DB_HOST','localhost');
……

6、接下来要做的就是用浏览器访问http://172.16.252.250/blog,根据系统的中文提示来完成个人博客的搭建

一、填写你登录自己博客的基本信息

wKioL1mGxUKhS-eTAAB4_SD3zNU787.png

二、跳转到设置成功的页面,你点击登录就可以进入自己的博客


wKiom1mGxUOgg2A_AAAg0RXdqjg021.png

wKioL1mGxUPx6LW-AAA2L63rRNk756.png

三、登录成功,可以尽情的设置你想要的一些东西。

wKioL1mGxUOhq8w9AAC16pU4-hs797.png



好了、搭建自己的博客我们就说说到这里啦,讲解描述得不清楚的地方请见谅。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


linux下开机自启: 在/etc/init.d目录下新建文件elasticsearch 并敲入shell脚本: 注意, 前两行必须填写,且要注释掉。 第一行为shell前行代码,目的告诉系统使用shell。 第二行分别代表运行级别、启动优先权、关闭优先权,且后面添加开机服务会用到。 shell脚本
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod +x /etc/rc.d/rc.local 2、赋予脚本可执行权限假设/usr/local/script/autostart.sh是你的脚本路径,给予执行权限 chmod +x /usr
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用ls -ll,会显示成字节大小,而ls- lh会以KB、MB等为单位进行显示,这样比较直观一些。 通过命令du -h –max-depth=1 *,可以查看当前目录下各文件、文件夹的大小,这个比较实用。 查询当前目录总大小可以使用d
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一但shell关闭网站也就关闭了,所以要配置守护进程, 用的是Supervisor,本文主要记录配置的过程和过程遇到的问题 安装Supervisor&#160;1 yum install python-setuptools
设置时区(CentOS 7) 先执行命令timedatectl status|grep &#39;Time zone&#39;查看当前时区,如果不是时区(Asia/Shanghai),则需要先设置为中国时区,否则时区不同会存在时差。 #已经是Asia/Shanghai,则无需设置 [root@xia
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=&quot;static&quot; ONBOOT=yes IPADDR=192.168.8.106 NETMASK=255.255.252.0 GATEWAY=192.168.
一、安装gcc依赖 由于 redis 是用 C 语言开发,安装之前必先确认是否安装 gcc 环境(gcc -v),如果没有安装,执行以下命令进行安装 [root@localhost local]# yum install -y gcc 二、下载并解压安装包 [root@localhost local
第一步 On CentOS/RHEL 6.*: $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm On CentOS/RHEL 7: $
/// &lt;summary&gt; /// 取小写文件名后缀 /// &lt;/summary&gt; /// &lt;param name=&quot;name&quot;&gt;文件名&lt;/param&gt; /// &lt;returns&gt;返回小写后缀,不带“.”&lt;/ret
which nohup .bash_profile中并source加载 如果没有就安装吧 yum provides */nohup nohup npm run start &amp; nohup ./kibana &amp;
1.1 MySQL安装 1.1.1 下载wget命令 yum -y install wget 1.1.2 在线下载mysql安装包 wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 1.1.3 安装My
重启 reboot shutdown -r now init 6 关闭 init 0 shutdown -h now shutdown -h 20:25 #8点25关机查看内存 free CPU利用率 top 日期 date 设置时间 date 033017002015 #月日时间年 日历 cal
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 :
1 下载并安装MySQL官方的&#160;Yum Repository wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 使用上面的命令就直接下载了安装用的Yum Repository,大概
CentOS6.x CentOS6中转用Upstrat代替以前的init.d/rcX.d的线性启动方式。 一、相关命令 通过initctl help可以查看相关命令 [root@localhost ~]# initctl help Job commands: start Start job. sto
1、使用命令:df -lk 找到已满磁盘 2、使用命令:du --max-depth=1 -h 查找大文件,删除
ifconfig:查看网卡信息 网卡配置文件位置: /etc/sysconfig/network-scripts/文件夹 nmtui:配置网卡 netstat -tlunp:查看端口信息 端口信息存储位置: /etc/services文件 route:查看路由信息 wget:下载网路文件,例如 wg
ps -ef:查看所有进程,&#160;ps -ef |grap firewalld 查看与firewalld相关的进程 which :查看进程:which firewalld kill 进程id:杀掉进程 kill 640,强制杀:kill -9 640 man:查看帮助,例如 man ps 查看
useradd:添加用户 useradd abc,默认添加一个abc组 vipw:查看系统中用户 groupadd:添加组groupadd ccna vigr:查看系统中的组 gpasswd:将用户abc添加到ccna组 gpasswd -a abc ccna groups abc:查看用户abc属