Linux下如何安装Discuz

写一个Linux下搭建Discuz论坛的全过程教程。

本例使用的Linux系统为:RHEL5.3。

1.[root@linux ~]# mkdir /mnt/cdrom

2.[root@linux ~]# mount /dev/cdrom /mnt/cdrom
这是在Windows下使用VMware虚拟机运行Linux的。
先在把RHEL5.3的ISO镜像文件加载到虚拟机的光驱,然后才执行mount命令。

3.[root@linux ~]# vi /etc/yum.repos.d/rhel-debuginfo.repo

原来:

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever – $basearch – Debug

baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

改成:(把原来的baseurl注释掉,在baseurl前面添加#,新添加baseurl=file:///mnt/cdrom/Server,并把enabled=0修改成enabled=1。)

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever – $basearch – Debug

#baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/

baseurl=file:///mnt/cdrom/Server

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

4.[root@linux ~]# yum clean all

5.[root@linux ~]# yum list

6.[root@linux ~]# yum grouplist   显示软件的安装包组。

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Setting up Group Process

rhel-debuginfo/group                                     | 1.0 MB     00:00

Installed Groups:

Administration Tools

Editors

Legacy Network Server

Mail Server

Network Servers

Server Configuration Tools

Sound and Video

System Tools

Available Groups:

Authoring and Publishing

DNS Name Server

Development Libraries

Development Tools

Engineering and Scientific

FTP Server

GNOME Desktop Environment

GNOME Software Development

Games and Entertainment

Graphical Internet

Graphics

Java Development

KDE (K Desktop Environment)

KDE Software Development

Legacy Software Development

Legacy Software Support

MySQL Database

News Server

Office/Productivity

OpenFabrics Enterprise Distribution

PostgreSQL Database

Printing Support

Text-based Internet

Web Server

Windows File Server

X Software Development

X Window System

Done

7.[root@linux ~]# yum groupinstall -y “MySQL Database”  安装MySQL。

8.[root@linux ~]# yum grouplist

9.[root@linux ~]# yum groupinstall -y “Web Server”

成功安装“MySQL Database”和“Web Server”之后,接着还需要安装php-mysql。

10.[root@linux ~]# yum list | grep php-*  把php相关的软件包都列出来。

11.[root@linux ~]# cd /mnt/cdrom/Server    进入软件包目录。

12.安装php-mysql,这里有个小技巧,就是输入rpm –ivh php-mysql之后,按TAB键,来实现补全这个安装包的名字。

[root@linux Server]# rpm -ivh php-mysql-5.1.6-23.2.el5_3.i386.rpm

error: Failed dependencies:

php-pdo is needed by php-mysql-5.1.6-23.2.el5_3.i386

13.出现错误需要php-pdo的依赖关系,需要把php-mysql和php-pdo两个包同时装上,这里也使用TAB键就可以补全软件包长长的名字。

[root@linux Server]# rpm -ivh php-mysql-5.1.6-23.2.el5_3.i386.rpm php-pdo-5.1.6-23.2.el5_3.i386.rpm

Preparing…                ########################################### [100%]

1:php-pdo                ########################################### [ 50%]

2:php-mysql              ########################################### [100%]

14.[root@linux Server]# service mysqld start         启动mysql,注意是mysqld,多一个字母d的。

15.[root@linux Server]# netstat -antupl | grep 3306       查看mysql状态

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4581/mysqld

16.[root@linux Server]# service httpd start          启动http,注意是httpd,多一个字母d的。

Starting httpd:                                            [  OK  ]

17.开启mysql和http在运行级别为3、4、5的时候开机后自动启动服务(注意mysql和mysqld,http和httpd,都多一个d字母的!)

[root@linux Server]# chkconfig  —level 345 mysqld on      ( level前面两个“-”减号的)

[root@linux Server]# chkconfig  —level 345 httpd on

18.我把论坛的zip压缩包Discuz_X1.5_SC_UTF8.zip放在了/root目录,所以回到root的用户目录,把压缩包解压出来。

[root@linux ~]# unzip Discuz_X1.5_SC_UTF8.zip

[root@linux ~]# ls

anaconda-ks.cfg  Discuz_X1.5_SC_UTF8.zip  install.log.syslog  upload

bbs              install.log              readme              utility

解压出来得到一个upload文件夹,把upload里面的文件都移到/var/www/html/目录。

19.[root@linux ~]# mv upload/* /var/www/html/

[root@linux ~]# ls /var/www/html

admin.php  crossdomain.xml  home.php    plugin.php  static

api        data             index.php   portal.php  template

api.php    favicon.ico      install     robots.txt  uc_client

config     forum.php        member.php  search.php  uc_server

cp.php     group.php        misc.php    source      userapp.php

20.[root@linux ~]# chmod -R 777 /var/www/html/   给论坛的所有文件都添加可读可写可执行的权限(注意:这里我是为了方便,把论坛的所有文件何目录都设成777是不科学的,实际情况并不需要全部777,把/config/、/data/、/uc_client/data、/uc_server/data设置成777就可以了)

[root@linux ~]# ls -l /var/www/html

total 104

-rwxrwxrwx  1 root root 2413 Oct 20 16:15 admin.php

drwxrwxrwx  7 root root 4096 Oct 20 16:15 api

-rwxrwxrwx  1 root root  741 Oct 20 16:15 api.php

……………..

21.[root@linux ~]# mysqladmin -u root password 123456   设置mysql的root用户密码为123456

22.[root@linux ~]# mysql -u root -p

Enter password:   (这里输入你设置的密码,输入是看不见的)

Welcome to the MySQL monitor.  Commands end with ; or \g.

已经进入mysql了

mysql> grant all on *.* to root@”%” identified by “123456”;   授权,允许root用户使用密码123456访问数据库。

23.剩下安装论坛的操作在浏览器下完成,用浏览器打开linux服务器的ip地址,以下就看图了。

(2)上一步选择“同意”后,出现“安装向导”,上图为第一步的“开始安装”。看到没有,上面都有“绿色”的勾,如果当初没有执行 chmod –R 777 /var/www/html/ 的话,这里就会是“红色”的叉了。选择“下一步”继续。

(3)安装向导的第二步,选择“全新安装Discuz!X”,当然也可以选择“仅安装Discuz!X”。“下一步”继续。

(4)看上图,只需修改用红圈圈起来的那几项。“下一步”继续。

(5)到了最后一步了。“联系方式”。“提交”。

(6)完成,上图所示。论坛安装完成了。

24.登录论坛。

成功登录。那么,整个搭建到安装就完成了。

### 回答1: 要在Linux安装Discuz论坛,您需要执行以下步骤: 1. 首先,您需要在Linux服务器上安装LAMP(Linux,Apache,MySQL和PHP)堆栈。 2. 然后,您需要下载Discuz论坛的最新版本,并将其解压缩到您的Web服务器的根目录中。 3. 接下来,您需要创建一个MySQL数据库,并为Discuz论坛创建一个新的数据库用户。 4. 然后,您需要编辑Discuz论坛的配置文件,以便将其连接到您的MySQL数据库。 5. 最后,您需要在Web浏览器中访问Discuz论坛的安装向导,并按照提示完成安装过程。 请注意,这只是一个简要的概述。在实际操作中,您可能需要进行更多的配置和调整,以确保Discuz论坛能够在Linux服务器上正常运行。 ### 回答2: Linux 是一套优秀的操作系统,常用于服务器端开发,因为其稳定性和安全性受到了广大开发者的青睐。Discuz! 是一款非常流行的开源论坛系统,可以满足各种不同大小、类型、领域的网站建设需求。下面将介绍如何在 Linux安装 Discuz! 论坛。 一、准备工作 在 Linux安装 Discuz! 可以使用 Web 服务器软件 Apache、Nginx 或 Lighttpd,同时需要 PHP 5.3 及以上版本和 MySQL 数据库。 1. 安装 Apache 或 Nginx 或 Lighttpd Apache 安装命令: sudo apt-get update sudo apt-get install apache2 Nginx 安装命令: sudo apt-get update sudo apt-get install nginx Lighttpd 安装命令: sudo apt-get update sudo apt-get install lighttpd 2. 安装 PHP 和 MySQL sudo apt-get update sudo apt-get install php sudo apt-get install mysql-server 二、下载并解压 Discuz! 从 Discuz! 官方网站 https://www.discuz.net/ 上下载最新的 Discuz! 压缩包,并解压到 Web 服务器的根目录,一般在 /var/www/html/ 或 /usr/share/nginx/html/ 下。 三、配置数据库 1. 创建数据库 首先登陆到 MySQL 数据库,使用 root 用户或有创建数据库权限的用户,创建一个新的数据库: mysql -u root -p CREATE DATABASE discuzdb; 2. 创建数据库用户及授权 使用 root 用户或有创建用户及授权权限的账户,创建一个新的 MySQL 用户并授予对数据库的所有权限: GRANT ALL PRIVILEGES ON discuzdb.* TO 'discuzuser'@'localhost' IDENTIFIED BY 'password'; 将上面的 discuzdb 修改为创建的数据库名称,将 discuzuser 修改为新建的数据库用户,将 password 修改为设定的密码。 四、配置 Discuz! 1. 配置 config.php 文件 进入 Discuz! 文件夹 /var/www/html/ 或 /usr/share/nginx/html/,并复制一份 config/config_global.sample.php 文件并重命名为 config/config_global.php,使用编辑器打开这个文件。 找到 $config['db'] 数组,修改以下参数: $config['db'][1]['dbhost'] = 'localhost'; $config['db'][1]['dbuser'] = 'discuzuser'; $config['db'][1]['dbpw'] = 'password'; $config['db'][1]['dbname'] = 'discuzdb'; 将 localhost 修改为服务器 MySQL 的地址,将 discuzuser 修改为新创建的用户名称,将 password 修改为该用户设定的密码,将 discuzdb 修改为创建的数据库名称。 接着,根据需求,修改数据表前缀和管理员账户(可根据需要修改): $config['tablepre'] = 'pre_'; $config['admincp']['username'] = 'admin'; $config['admincp']['password'] = 'adminpassword'; 将 pre_ 修改为任意数据表前缀,将 admin 修改为自己设定的管理员账号,将 adminpassword 修改为自己设定的密码。 2. 修改文件和目录权限 进入文件夹,依次执行以下命令: cd usr/share/nginx/html sudo mkdir data sudo mkdir uc_server/data sudo chmod 777 config sudo chmod 777 data sudo chmod 777 uc_server/data 以上命令为新建 data 和 uc_server/data 文件夹,并将 config、data 和 uc_server/data 文件夹修改为最高可执行权限,确保可以对其进行写入。 3. 运行网站安装程序 打开浏览器,访问 http://your_ip,进入 Discuz! 的安装界面,然后按提示进行安装即可。 通过上述步骤,你就可以在 Linux 系统中安装 Discuz! 论坛,同时如果需要修改网站内容、主题等,可以自行进行页面编辑,或者访问 Discuz! 官方网站,寻找需要的插件、模板等。 ### 回答3: Discuz是一个非常流行的论坛程序,许多人喜欢在自己的网站上使用该程序搭建论坛。Linux是一种非常流行的操作系统,如果你也希望在Linux安装Discuz论坛,那么可以按照以下步骤进行。 1.准备工作 在安装Discuz之前,你需要一台安装Linux操作系统的服务器,以及一个域名。除此之外还需要安装一些必要的软件,如Apache、MySQL和PHP等等。 2.下载Discuz论坛程序 你可以在Discuz官方网站上下载最新版本的论坛程序。将下载的文件解压缩到web服务器的目录中,例如/var/www/html/discuz。 3.创建数据库 在安装Discuz之前,你需要在MySQL中创建一个新的数据库,并在其中创建一个数据库用户。你可以在命令行客户端上运行以下命令: $ mysql -u root -p mysql> create database discuzdb; mysql> grant all privileges on discuzdb .* to 'discuzuser'@'localhost' identified by 'mypassword'; mysql> flush privileges; mysql> exit 4.运行安装向导 在浏览器中输入http://yourdomain.com/discuz/install.php,开始安装向导。在安装过程中,你需要输入一些关于数据库和管理员设置的信息,确保所有信息都输入正确,否则安装将失败。 5.安装完成 完成安装向导后,你应该能够访问Discuz论坛并开始使用它。确保在完成安装后删除/install文件夹,以确保安全。 总之,在Linux安装Discuz论坛并不是非常困难,只需按照上述步骤,你可以在短时间内成功地完成安装过程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值