0 背景使用openSUSE系统，docker官方不支持直接使用命令安装。而系统自带的源中的版本太旧了，因此只能使用手动安装二进制包的形式，手动安装docker-compose插件。1 手动安装docker二进制包1、进入以下链接，下载需要的包。https://download.docker.com/linux/static/stable/x86_64/2、将包解压。3、使用以下命令移动到指定位置。sudo cp docker/* /usr/bin/4、启动守护进程。sudo dockerd &2 手动安装docker compose插件1、执行以下命令。DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} mkdir -p $DOCKER_CONFIG/cli-plugins curl -SL https://github.com/docker/compose/releases/download/v2.33.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose2、赋予权限。chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
背景FreeBSD是一个类Unix系统，比同样是类Unix系统的Linux更加接近Unix。在我的一台腾讯云服务器上，就安装了FreeBSD，作为一个计算机爱好者的独特体验。那么怎么样把FreeBSD、把这台服务器用起来呢？最简单的办法就是在上面跑一些应用。因此，我选择跑一个博客。然而，与Linux相比，FreeBSD系统的教程非常少。花费了一些时间才把这个Ghost博客搭建起来。为此，把相关搭建过程记录下来。搭建过程一、以root用户执行下列过程1、安装所需的软件包。# pkg update # pkg install mysql80-server mysql80-client node18 npm-node18 nginx如果安装过慢，可以更换成中科大源。2、启用mysql# service mysql-server enable # service mysql-server start # mysql_secure_installation在此过程中，设置mysql的root密码。3、创建ghost数据库用户。# mysql -u root -p CREATE USER 'ghost'@'localhost' IDENTIFIED BY 'IsThisEnoughBitsOfEntropy?_^'; CREATE DATABASE yourblog_ext_prod; GRANT ALL privileges ON `yourblog_ext_prod`.* TO 'ghost'@'localhost';请注意，将上面的相关信息更换成你自己的信息。4、启用nginx# service nginx enable # service nginx start5、安装ghost-cli# npm install ghost-cli -g如果安装速度过慢，更新成腾讯源。即使更新成腾讯源，也要大概30分钟。6、在FreeBSD系统上创建一个新用户。这里假设创建的用户名为user。然后执行以下操作：# mkdir /usr/local/www/yourblog.ext # chown user:user /usr/local/www/yourblog.ext # chmod 775 /usr/local/www/yourblog.ext # su - ghost $ cd /usr/local/www/yourblog.ext二、现在是以user身份：7、执行以下命令。$ ghost install依次输入以下信息：? Enter your blog URL: https://yourblog.ext/ ? Enter your MySQL hostname: 127.0.0.1 ? Enter your MySQL username: ghost ? Enter your MySQL password: [hidden] ? Enter your Ghost database name: ghostdemo_prod ✔ Configuring Ghost ✔ Setting up instance ℹ Setting up "ghost" mysql user [skipped] Nginx is not installed. Skipping Nginx setup. ℹ Setting up Nginx [skipped] Nginx setup task was skipped, skipping SSL setup ℹ Setting up SSL [skipped] ? Do you wish to set up Systemd? No Systemd setup skipped, reverting to local process manager ℹ Setting up Systemd [skipped] ? Do you want to start Ghost? No ℹ Starting Ghost [skipped]8、修改权限，保护密码安全：$ chmod 600 /usr/local/www/yourblog.ext/config.production.json $ ghost start三、切换到root用户，完成以下操作。9、修改/usr/local/etc/nginx/nginx.conf ，改为以下内容：http { include mime.types; include /usr/local/etc/nginx/sites-enabled/*.conf; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; }10、创建以下两个文件夹，以符合nginx规范。# mkdir /usr/local/etc/nginx/sites-available # mkdir /usr/local/etc/nginx/sites-enabled11、编辑/usr/local/etc/nginx/sites-available/yourblog_ext.conf，写入以下内容：server { listen 80; listen [::]:80; server_name yourblog.ext; location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; listen [::]:443 ssl; server_name yourblog.ext; location / { proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:2368/; } ssl_certificate /usr/local/etc/letsencrypt/live/yourblog.ext/fullchain.crt; ssl_certificate_key /usr/local/etc/letsencrypt/live/yourblog.ext/privkey.key; }注意，ssl路径可以自定义。12、执行以下命令，完成nginx配置。# ln -s /usr/local/etc/nginx/sites-available/yourblog_ext.conf /usr/local/etc/nginx/sites-enabled/yourblog_ext.conf # nginx -t # service nginx restart完成上述配置后，访问以下链接，访问ghost服务。https://你的域名/ghost参考链接https://www.blakecarpenter.dev/install-ghost-on-freebsd/