经过无数次无数次的测试以及参考全网各种各样的博客文档,我总结了以下几步:
1. 打开Ubuntu 先换源加更新源(不加源肯定是后面会出问题的,再说这东西多多益善嘛):
使用vim编辑器打开souce.lise:
sudo vim /etc/apt/sources.list
按a进入编辑模式,然后在下面的空白处把这些源统统贴进去:
#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#阿里云源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
添加好后按ESC退出编辑模式,然后键入:wq
保存退出
然后开始更新源:
sudo apt-get update
更新源完成!
2. 安装docker
这个比较简单,只需要一句命令:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
等他运行完docker就已经安装完成了,这时我们键入
sudo docker run hello-world
如果显示为
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete Digest: sha256:c3b4ada4687bbaa170745b3e4dd8ac3f194ca95b2d0518b417fb47e5879d9b5f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
那表示docker已安装成功!
3. docker安装mysql
进行这步需要知道,huginn本身是可以存储一部分数据的,但是不好用,所以我们需要在docker中搭建一个mysql来方便huginn存储日子和数据
先创建一个空容器并起名叫mysql,并指定了版本为5.6:
sudo docker pull mysql:5.6
开始run这个容器,这里就要设置mysql的密码了,大家需要改成自己的密码嗷:
sudo docker run --name mysql -e MYSQL_ROOT_PASSWORD=你的密码 -p 3306:3306 -d mysql:5.6
接着进入MySQL容器
sudo docker exec -it mysql bash
mysql -u root -p
输入自己的密码进入mysql然后开始修改权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
刷新一哈user表:
flush privileges;
完成好就可以关闭mysql啦!
4. 安装huginn
docker创建一个空容器:
sudo docker pull huginn/huginn
输入ifconfig查看一个docker的本地IP并记录下来
配置huginn以及mysql:
sudo docker run --name huginn -p 3000:3000 -e MYSQL_PORT_3306_TCP_ADDR=你的dockerIP -e HUGINN_DATABASE_NAME=huginn -e HUGINN_DATABASE_USERNAME=root -e HUGINN_DATABASE_PASSWORD=你的mysql密码 huginn/huginn
然后就开始等吧~这个受制于网络环境可能会安装很久很久,然后等你觉得差不多了,在浏览器中输入http://你的服务器IP:3000并访问,出现页面就表示huginn安装成功了!
装环境嘛 装个一两天是常有的事慢慢来~