Discourse build

First connect to the server

First of all, open CMDER for WINDOWS, and open Terminal for MAC, both of which are similar.

Enter ssh root@ALIYUN_IP in the window. Here ALIYUN_IP is the public IP address of your server. For example, my public IP is 47.88.12.221, then I need to enter:

ssh [email protected]

When connecting for the first time, you need to enter yes/no. At this time, just enter yes directly.

Then you will be asked to enter a password, which is the password you entered when purchasing ecs. For example, the password of this server is ggwpXmgseo_123, so I just enter:

// 我直接输入ggwpXmgseo_123,但是屏幕上不会显示出来。因为是敏感数据。

[email protected]'s password:

After successfully connecting to the server, you will see the following words. This is taking Alibaba Cloud as an example.

Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-162-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Welcome to Alibaba Cloud Elastic Compute Service !

root@discourse:~#

Update apt first

Now that the server is connected, update apt first.

apt-get update

During the update process, you will see a percentage and it will take a little time.

Install Git

Next install the git tool on the server

apt install git-all

During the installation process, you will be asked Y/n questions, just enter y directly, which means yes (continue to install).

Start installing Discourse

Next clone the official discourse docker image. Just enter the following code directly in the window.

sudo -s
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse

After installing and executing the cd command, you should see something similar to the following displayed in your window.

// 你的路径已经被改成成了/var/discourse
// 如果你的前缀是其它的,例如root@asdasdfo-12312,这是很正常的。代表着你的服务器的名字和我的服务器的名字不同罢了。
root@discourse:/var/discourse#

Screen Shot 2021-12-10 at 10.35.26 AM.png

Install Docker

Remove older versions of Docker, if any.

sudo apt-get remove docker docker-engine docker.io containerd runc

Prepare for installation

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Add the official GPG

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Set up a stable Repo

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

update before installation

sudo apt-get update

official installation

sudo apt-get install docker-ce docker-ce-cli containerd.io

If you have successfully installed, you enter docker psthis command, you will see the following display.

CONTAINER ID   IMAGE             COMMAND                  CREATED        STATUS        PORTS     NAMES

Delete the port 80 process

Sometimes, there will be cases where port 80 is occupied. It is impossible to initialize discourse like this.

kill $(sudo netstat -anp | awk '/ LISTEN / {if($4 ~ ":80$") { gsub("/.*","",$7); print $7; exit } }')

Initialize Discourse

Make sure you are fighting the path

cd /var/discourse

Run the command below directly to start initializing Discourse

./discourse-setup

You will see the following questions pop up, and you need to answer and enter one by one.

// 你的域名,我的就是forum.xmg180.com
Hostname for your Discourse? [discourse.example.com]: forum.xmg180.com

// 你的邮箱,我们的示范里面就是我的qq邮箱,一定需要是你可以登录的邮箱
Email address for admin account(s)? [[email protected],[email protected]]: [email protected]

// SMTP服务器,我们情况就是in-v3.mailjet.com
SMTP server address? [smtp.example.com]: in-v3.mailjet.com

// SMTP的端口,Mailjet 就是 587
SMTP port? [587]: 587

// SMTP的用户名:我们的情况就是输入Mailjet的API KEY,也就是SMTP USERNAME
SMTP user name? [[email protected]]:  a7ba0412312a473a9d123pansdf61586de

// SMTP的密码:来自于Mailjet提供的SMTP密码,也就是SMTP Password
SMTP password? [pa$$word]: 65dd6a9fea782a51a18c7985198d12a5

// 消息接收邮箱,我们的企业邮箱[email protected]
notification email address? [[email protected]]: [email protected]

// SSL的邮箱,这个地方输入自己的邮箱即可,推荐企业邮箱
Optional email address for Let's Encrypt warnings? (ENTER to skip) [[email protected]]: [email protected]

// 额外的maxmind参数,忽略即可,直接确认键跳过。
Optional Maxmind License key () [xxxxxxxxxxxxxxxx]:

After the input is complete, it will ask you, are these data parameters correct? You just need to hit the OK key on your keyboard to continue. For example:

Does this look right?

Hostname          :  [email protected]
Email             :  [email protected]
SMTP address      :  in-v3.mailjet.com
SMTP port         :  587
SMTP username     : 1asd2312390123pasidhfpoasi1
SMTP password     : a8sds709fdg878089vc7x0bx
Notification email:  [email protected]
Let's Encrypt :  [email protected]
Maxmind license: (unset)


// 敲击键盘的确认键继续,如果你输入ctril+c,则是代表重新填写。

Next, Discourse will automatically start the installation. You can see a progress bar on the screen.

letsencrypt.ssl.template.yml enabled


Configuration file at containers/app.yml updated successfully!

Updates successful. Rebuilding in 5 seconds.
Building app
x86_64 arch detected.

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

2.0.20211118-0105: Pulling from discourse/base
a10c77af2613: Pull complete 
2a94306b3060: =======> Do

Start your Discourse

接下来你只需要打开你的网站域名,例如forum.xmg180.com即可。我的是打不开的,因为我将其关闭了。我上面这个只是作为示范教学教大家如何搭建而已。

打开之后,你会看到欢迎界面。其实剩下的东西我觉得就没必要教你了。Discourse会引导你创建第一个账户,成为超级管理员。然后你的论坛就正式开启了。

Screen Shot 2021-12-10 at 2.19.33 PM.png

注册成功之后,会通过你刚才所设置的邮箱发送邮件给你。你会收到下述的这个邮件。

Screen Shot 2021-12-10 at 8.37.42 PM.png

点击链接,正式激活你的论坛。在初始化过程中,如果卡死了,可以选择点击Maybe later。我就遇到了这种情况。

Screen Shot 2021-12-10 at 8.38.00 PM.png

到此,和Anker一样的论坛就搭建完成了。Anker还自行添加了自己的风格,我们当然也可以。

如果你想要管理用户和修改风格的话,或者是学习Anker和亚马逊官方的论坛风格,你只需要在右上角点击三条杠,然后找到Admin和Setting即可。

Screen Shot 2021-12-10 at 8.50.14 PM.png

Guess you like

Origin blog.csdn.net/muzihuaner/article/details/131758174