LANP如何塔建Discuz论坛
小编给大家分享一下LANP如何塔建Discuz论坛,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
建网站原本是网站策划师、网络程序员、网页设计师等,应用各种网络程序开发技术和网页设计技术配合操作的协同工作。创新互联专业提供网站建设、网站设计,网页设计,网站制作(企业站、响应式网站设计、电商门户网站)等服务,从网站深度策划、搜索引擎友好度优化到用户体验的提升,我们力求做到极致!
LAMP="Linux Apache MySQL PHP/Python"
Linux常指代系统,没有明确规定版本,如CentOS/Ubuntu/Debian等都可以作为服务器系统
Apache是Web解析的引擎,用于将网页源代码文件处理成浏览器可转换的页面文件
MySQL数据库,MySQL是关系型数据库,以表的形式来保存数据,其中数据存储是以行和列的方式存储
PHP是网页脚本语言,用于生成页面框架,不可单独使用,一般作为Apache的语言扩展(使Apache可以支持更多页面语言)
-自定义仅主机模式,挂载光盘
源码包上传到虚拟机
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33 #静态IP BOOTPROTO=static ONBOOT=yes IPADDR=192.168.18.6 NETMASK=255.255.255.0 GATEWAY=192.168.18.0 :wq #退出 [root@localhost ~]# mkdir /media/dvd #光盘 [root@localhost ~]# mount /dev/cdrom /media/dvd/ mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# mkdir /yum.repo.bak [root@localhost ~]# mv /etc/yum.repos.d/* /yum.repo.bak/ [root@localhost ~]# vim /etc/yum.repos.d/yum.repo [localyum] name=yum baseurl=file:///media/dvd enabled=1 gpgcheck=0 :wq #退出
HTTP安装:
在服务端配置本地yum
[root@localhost ~]# mkdir /media/dvd [root@localhost ~]# mount /dev/cdrom /media/dvd/ mount: /dev/sr0 is write-protected, mounting read-only [root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# mkdir /yum.repo.bak [root@localhost yum.repos.d]# mv * /yum.repo.bak/ [root@localhost yum.repos.d]# ls [root@localhost yum.repos.d]# vim yum.repo [localyum] name=yum #名称 baseurl=file:///media/dvd #指定路径 enabled=1 gpgcheck=0 [root@localhost ~]# yum -y install gcc gcc-c++ #安装编译工具
将httpd的源码包上传到虚拟机中
[root@localhost ~]# tar zxf httpd-2.2.17.tar.gz -C /usr/src #解压到/usr/src [root@localhost ~]# cd /usr/src/httpd-2.2.17 [root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi #配置
[root@localhost httpd-2.2.17]# make && make install #编译
[root@localhost ~]# ln -s /usr/local/httpd/bin/* /usr/local/bin #优化路径 [root@localhost httpd-2.2.17]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd #添加系统服务 [root@localhost ~]# vim /etc/init.d/httpd # 添加内容到 第3第4行 #!/bin/sh # #chkconfig:35 25 25 #第3行35为开机顺序 25 为运行等级 #description:haha #4行 注释为什么都行 :wq #退出 [root@localhost ~]# chkconfig --add httpd
mysql安装:
rpm -q mysql-server mysql #检查有无自带的mysql包 package mysql-server is not installed package mysql is not installed #这里没有 mkdir /media/dvd #挂载光盘 mount /dev/cdrom /media/dvd/ mount: /dev/sr0 is write-protected, mounting read-only cd /media/dvd/Packages/ #安装所需的软件 rpm -ivh ncurses-devel-5.9-13.20130511.el7.x86_64.rpm warning: ncurses-devel-5.9-13.20130511.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:ncurses-devel-5.9-13.20130511.el7################################# [100%] cd ls #找到cmake包和mysql包安装的目录 anaconda-ks.cfg cmake-2.8.6.tar.gz initial-setup-ks.cfg mysql-5.5.22.tar.gz tar zxf cmake-2.8.6.tar.gz -C /usr/ #指定解压到/usr目录下 cd /etc/yum.repos.d/ #需要下载编译工具所以先配置yum mkdir /yum.repo.bak #创建存放yum原本包的目录 mv * /yum.repo.bak/ #移动所有包到新建的目录 ls #查看没有1了 vim yum.repo #配置yum [localyum] name=yum #名称 baseurl=file:///media/dvd #路径 enabled=1 gpgcheck=0 :wq yum -y install gcc gcc-c++ #安装 Complete! cd /usr/cmake-2.8.6/ ./configure
gmake && gmake install
groupadd mysql useradd -M -s /sbin/nologin mysql -g mysql cd tar zxf mysql-5.5.22.tar.gz -C /usr/src/ cd /usr/src/mysql-5.5.22/ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFIGDIR=/etc/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSET=all
1指定安装目录
2指定初始化参数文件目录、
3指定默认使用的字符集编码
4指定字符集校订规格
utf8_general_ci 额外的字符集编码
make -j 2 && make install -j 2
chown -R mysql:mysql /usr/local/mysql/ rm -rf /etc/my.cnf cp support-files/my-medium.cnf /etc/my.cnf /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
#代表成功了
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile . /etc/profile #.点后有空格 cp support-files/mysql.server /etc/rc.d/init.d/mysqld chmod a+x /etc/rc.d/init.d/mysqld chkconfig --add mysqld
PHP安装:
[root@localhost ~]# rpm -e php php-cli php-ldap php-commom php-mysql --nodeps error: package php is not installed error: package php-cli is not installed error: package php-ldap is not installed error: package php-commom is not installed error: package php-mysql is not installed [root@localhost ~]# cd /media/dvd/Packages/ [root@localhost Packages]# rpm -ivh libxml2-2.9.1-6.el7_2.3.x86_64.rpm warning: libxml2-2.9.1-6.el7_2.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] package libxml2-2.9.1-6.el7_2.3.x86_64 is already installed [root@localhost Packages]# rpm -ivh zlib-devel-1.2.7-17.el7.x86_64.rpm warning: zlib-devel-1.2.7-17.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zlib-devel-1.2.7-17.el7 ################################# [100%] [root@localhost Packages]# rpm -ivh xz-devel-5.2.2-1.el7.x86_64.rpm warning: xz-devel-5.2.2-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:xz-devel-5.2.2-1.el7 ################################# [100%] [root@localhost Packages]# rpm -ivh libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm warning: libxml2-devel-2.9.1-6.el7_2.3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:libxml2-devel-2.9.1-6.el7_2.3 ################################# [100%] [root@localhost Packages]# cd [root@localhost ~]# tar zxf libmcrypt-2.5.8.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/libmcrypt-2.5.8/ [root@localhost libmcrypt-2.5.8]# ./configure && make && make install [root@localhost libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.* /usr/src/ [root@localhost libmcrypt-2.5.8]# cd [root@localhost ~]# tar zxf mhash-0.9.9.9.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/mhash-0.9.9.9/ [root@localhost mhash-0.9.9.9]# ./configure && make && make install [root@localhost ~]# tar zxf mcrypt-2.6.8.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/mcrypt-2.6.8/
直接配置会报错 所以先修改一下环境变量
[root@localhost mcrypt-2.6.8]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH [root@localhost mcrypt-2.6.8]# ./configure [root@localhost mcrypt-2.6.8]# make -j 2 && make install -j 2 [root@localhost mcrypt-2.6.8]# cd [root@localhost ~]# tar zxf php-5.3.28.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/php-5.3.28/ [root@localhost php-5.3.28]# ln -s /usr/local/libmhash.* /usr/lib [root@localhost php-5.3.28]# ./configure --prefix=/usr/local/php5 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5 --enable-mbstring --prefix=/usr/local/php5 #路径 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql #mysql路径 --with-config-file-path=/usr/local/php5 #配置文件路径 --enable-mbstring #开启字符串 creating main/internal_functions.c creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
[root@localhost php-5.3.28]# make && make install
[root@localhost php-5.3.28]# cp /usr/src/php-5.3.28/php.ini-development /usr/local/php5/php.ini [root@localhost php-5.3.28]# vim /usr/local/php5/php.ini vim 修改 226 short_open_tag = on #打开 782 ; PHP's default character set is set to empty. 783 ; http://php.net/default-charset 784 default_charset = "utf-8" #去掉注释 改为 “utf-8” :wq 退出 [root@localhost ~]# tar zxf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ [root@localhost php-5.3.x]# cp ZendGuardLoader.so /usr/local/php5/lib/php/ [root@localhost php-5.3.x]# vim /usr/local/php5/php.ini
增加以下俩行
zend_extension=/usr/local/php5/lib/php/ZendGuardLoader.so zend_loader.enable=1 :wq #退出 [root@localhost php-5.3.x]# vim /usr/local/httpd/conf/httpd.conf 54 和168行进行增加和修改 51 # Example: 52 # LoadModule foo_module modules/mod_foo.so 53 LoadModule php5_module modules/libphp5.so 54 AddType application/x-httpd-php .php #空行新增一行 55 # 163 # 164 # DirectoryIndex: sets the file that Apache will serve if a directory 165 # is requested. 166 # 167168 DirectoryIndex index.html index.php #在此行增加 169 :wq #退出 [root@localhost php-5.3.x]# systemctl restart httpd [root@localhost php-5.3.x]# systemctl restart mysqld [root@localhost php-5.3.x]# cd [root@localhost ~]# vim /usr/local/httpd/htdocs/index.php :wq #退出 [root@localhost ~]# firefox 192.168.18.6/index.php
访问成功
[root@localhost ~]# cd [root@localhost ~]# tar zxf phpMyAdmin-4.2.5-all-languages.tar.gz -C /usr/src/ [root@localhost ~]# cd /usr/src/ [root@localhost src]# mv phpMyAdmin-4.2.5-all-languages/ /usr/local/httpd/htdocs/phpMyAdmin [root@localhost src]# cd /usr/local/httpd/htdocs/phpMyAdmin/ [root@localhost phpMyAdmin]# cp config.sample.inc.php config.inc.php [root@localhost phpMyAdmin]# mysqladmin -u root -p password '123' Enter password: [root@localhost phpMyAdmin]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.22-log Source distribution Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit Bye
登录好了点执行
[root@localhost ~]# vim /usr/local/httpd/htdocs/test.php :wq #退出 [root@localhost ~]# firefox 192.168.18.6/test.php
[root@localhost ~]# unzip Discuz_7.2_FULL_SC_UTF8.zip [root@localhost ~]# mv upload/ /usr/local/httpd/htdocs/bbs [root@localhost ~]# chown -R daemon:daemon /usr/local/httpd/htdocs/bbs/ [root@localhost ~]# systemctl restart httpd [root@localhost ~]# systemctl start httpd [root@localhost ~]# firefox 192.168.18.6/bbs/install
[root@localhost ~]# netstat -anput | grep httpd tcp6 0 0 :::80 :::* LISTEN 81067/httpd
#如退出进来出现上面现象执行下面步骤
[root@localhost ~]# firefox 192.168.18.6/bbs
nginx和apache的区别
nginx:
优点:轻量级,对静态文件处理较好,并发量高
缺点:对动态文件处理时,可能出现问题
nginx无法处理php文件,但可以找帮手帮他处理
apache:
优点:对动态文件处理较好,稳定,安全
缺点:服务臃肿,运行效率低
以上是“LANP如何塔建Discuz论坛”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
新闻名称:LANP如何塔建Discuz论坛
网站URL:http://scyanting.com/article/jsgghc.html