centos7.3编译安装LAMP环境并搭建WordPress博客

前端之家收集整理的这篇文章主要介绍了centos7.3编译安装LAMP环境并搭建WordPress博客前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_0@centos7.3编译安装LAMP环境并搭建wordpress博客

@H_502_0@日期:2017年8月6日

@H_502_0@

@H_502_0@软件版本:

@H_502_0@apr-1.5.2.tar.bz2

@H_502_0@apr-util-1.5.4.tar.bz2

@H_502_0@httpd-2.4.27.tar.bz2

@H_502_0@mariadb-10.2.7-linux-x86_64.tar.gz

@H_502_0@PHP-7.1.7.tar.bz2

@H_502_0@wordpress-4.8-zh_CN.tar.gz

@H_502_0@xcache-3.2.0.tar.gz

@H_502_0@

@H_502_0@1.编译安装apache2.4

  1. yumgroupinstalldevelopmenttools
  2. yuminstallpcre-developenssl-devel@H_403_37@
  3. @H_502_0@解压缩httpd包和两个apr包,注意apr包的解压路径为httpd-xxx/srclib目录

  4. tar-xvfhttpd-2.4.27.tar.bz2-C/tmp/
  5. tar-xvfapr-1.5.2.tar.bz2-C/tmp/httpd-2.4.27/srclib/
  6. tar-xvfapr-util-1.5.4.tar.bz2-C/tmp/httpd-2.4.27/srclib/
  7. cd/tmp/httpd-2.4.27/srclib/
  8. mvapr-1.5.2/apr
  9. mvapr-util-1.5.4/apr-util@H_403_37@ 
  10. @H_502_0@创建httpd的安装目录

  11. mkdir/app/web
  12. cd/tmp/httpd-2.4.27
  13. ./configure--prefix=/app/web--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
  14. make&&makeinstall@H_403_37@ 
  15. @H_502_0@添加启动路径脚本

  16. vi/etc/profile.d/web.sh
  17. exportPATH=/app/web/bin:$PATH
  18. ./etc/profile.d/web.sh@H_403_37@ 
  19. @H_502_0@启动服务并检查端口是否开启

  20. apachectl
  21. ss-ntl
  22. manapachectl@H_403_37@ 
  23. @H_502_0@2.安装mariadb10.2

  24. @H_502_0@如果之前已安装过mariadb,则需要先卸载

  25. rpm-qamariadb
  26. yuminfomariadb
  27. yumremovemariadb@H_403_37@ 
  28. @H_502_0@mariadb包为二进制包,无需编译直接安装即可,注意必须指定解压目录为/usr/local

  29. tar-xfmariadb-10.2.7-linux-x86_64.tar.gz-C/usr/local
  30. cd/usr/local/
  31. ln-smariadb-10.2.7-linux-x86_64/MysqL@H_403_37@ 
  32. @H_502_0@系统如果没有MysqL用户则执行

  33. useradd-rMysqL-s/sbin/nologin-d/app/mariadb-m@H_403_37@ 
  34. @H_502_0@如果有则执行

  35. usermod-d/app/mariadbMysqL@H_403_37@ 
  36. @H_502_0@确认MysqL用户信息

  37. getentpasswdMysqL@H_403_37@ 
  38. @H_502_0@安装数据库,指定安装目录和用户

  39. cd/usr/local/MysqL/
  40. ./scripts/MysqL_install_db--datadir=/app/mariadb--user=MysqL@H_403_37@ 
  41. @H_502_0@创建主配置文件

  42. mkdir/etc/MysqL
  43. cpsupport-files/my-huge.cnf/etc/MysqL/my.cnf
  44. vim/etc/MysqL/my.cnf
  45. [MysqLd]加三行
  46. datadir=/app/MysqLdb
  47. innodb_file_per_table=ON
  48. skip_name_resolve=ON@H_403_37@ 
  49. @H_502_0@添加启动路径脚本

  50. vi/etc/profile.d/web.sh
  51. exportPATH=/app/web/bin:/usr/local/MysqL/bin:$PATH
  52. ./etc/profile.d/web.sh@H_403_37@ 
  53. @H_502_0@添加到系统服务

  54. cpsupport-files/MysqL.server/etc/init.d/MysqLd
  55. chkconfig--addMysqLd
  56. chkconfig--listMysqLd
  57. serviceMysqLdstart@H_403_37@ 
  58. @H_502_0@设置MysqLroot密码和其他安全配置

  59. MysqL_secure_installation@H_403_37@ 
  60. @H_502_0@登录MysqL创建数据库和远程登录账户

  61. MysqL-uroot-p
  62. MariaDB[(none)]>createdatabasewpdb;
  63. MariaDB[(none)]>grantallonwpdb.*towpuser@'192.168.10.%'identifiedby"redhat";@H_403_37@ 
  64. @H_502_0@3.编译安装PHP7.1

  65. tarxvfPHP-7.1.7.tar.bz2
  66. cd/root/src/PHP-7.1.7/
  67. yum-yinstalllibxml2-develbzip2-devellibmcrypt-devel
  68. 注:libmcrypt这个包需要epel@H_403_37@ 
  69. ./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/web/bin/apxs--with-mcrypt--with-config-file-path=/etc--with-config-file-scan-dir=/etc/PHP.d--with-bz2
  70. make&&makeinstall@H_403_37@ 
  71. @H_502_0@查看httpd是否已增加PHP7的模块

  72. more/app/web/conf/httpd.conf|grepPHP
  73. LoadModulePHP7_modulemodules/libPHP7.so
  74. 创建PHP配置文件
  75. cpPHP.ini-production/etc/PHP.ini
  76. vim/app/web/conf/httpd.conf增加如下内容
  77. AddTypeapplication/x-httpd-PHP.PHP
  78. AddTypeapplication/x-httpd-PHP-source.PHPs
  79. <IfModuledir_module>
  80. DirectoryIndexindex.PHPindex.html
  81. </IfModule>@H_403_37@ 
  82. @H_502_0@重启httpd服务

  83. apachectlrestart
  84. apachectl@H_403_37@ 
  85. @H_502_0@测试PHPMysqL,增加如下的主页文件,打开网页测试连接数据库成功或失败

  86. vi/app/web/htdocs/index.PHP@H_403_37@ 
  87. <?PHP
  88. $MysqLi=newMysqLi("127.0.0.1","root","redhat");
  89. if(MysqLi_connect_errno()){
  90. echo"连接数据库失败!";
  91. $MysqLi=null;
  92. exit;
  93. }
  94. echo"连接数据库成功!";
  95. $MysqLi->close();
  96. PHPinfo();
  97. ?>@H_403_37@ 
  98. @H_502_0@4.安装wordpress

  99. @H_502_0@解压包到web默认目录htdocs

  100. tarxfwordpress-4.8-zh_CN.tar.gz-C/app/web/htdocs/
  101. cd/app/web/htdocs/
  102. mvwordpress/wp
  103. cdwp
  104. cpwp-config-sample.PHPwp-config.php@H_403_37@ 
  105. @H_502_0@vim wp-config.php 手动更改以下4

  106. /**wordpress数据库名称*/
  107. define('DB_NAME','wpdb');
  108. /**MysqL数据库用户名*/
  109. define('DB_USER','wpuser');
  110. /**MysqL数据库密码*/
  111. define('DB_PASSWORD','redhat');
  112. /**MysqL主机*/
  113. define('DB_HOST','192.168.10.33');@H_403_37@ 
  114. @H_502_0@5.编译安装xcache3.2

  115. @H_502_0@注意:PHPize命令需要安装PHP-devel

  116. tar-xf/mnt/hgfs/vms/lamp-c73/xcache-3.2.0.tar.gz-C/tmp/
  117. cd/tmp/xcache-3.2.0/
  118. moreINSTALL
  119. PHPize--clean&&PHPize
  120. ./configure--enable-xcache--with-PHP-config=/usr/bin/PHP-config
  121. make&&makeinstall
  122. maketest
  123. cpxcache.ini/etc/PHP.d/
  124. apachectlrestart@H_403_37@ 
  125. @H_502_0@博客访问地址:

  126. @H_502_0@http://192.168.10.33/wp/

猜你在找的CentOS相关文章