简单(不是)安装一个博客,用于记录思想的琐碎

新建博客以记录安装流程,最终我们会通过半自动半手动建立起一个blog系统,涉及到VPS服务器,Docker,CloudFlare(DDNS),let's encrypt & ACME(Automated Certificate Management Environment)

  • 服务器(VPS)
  • 基础软件安装(Docker、python3-pip)
  • CloudFlare DDNS 设置(动态DNS保护)
  • let's encrypt & ACME

这里我们选择自己在服务器上建立软件服务,使用托管系统的话没有必要,因为本身这个东西搭建很简单,也还可以用剩余空间搭建其他的服务,

服务器的选择和注册、安装,略过,系统选择Ubuntu

主要任务:

  1. Install docker
  2. Install python3-pip,docker-compose
  3. 配置docker镜像启动文件docker-compose.yml
  4. 购买域名、指向CloudFlare DNS服务器
  5. 获取CF DNS Certificate APIKEY
  6. 使用ACME.SH配置域名(泛域名证书)
  7. 选择Web服务器 可以使用 LAMP.SH/LNMP.ORG (不使用docker 快速,直接
    我这里选择LAMP.SH 快速,配置自动化
#我们选择docker+nginx的方式,不选择使用lamp.sh/lnmp.org
#为啥呢?太子动化了
#但是为了图简单好用,还是lamp.sh/lnmp.org把
我这里选择lamp.sh(nginx bug确实多,配置个https都能无限loop)

#lamp安装在ubuntu18.04上(19以上php安装依赖freetype版本不兼容)

docker化Web服务器

选用nginx,并不使用docker网络概念,直接挂载端口
docker run -d -p 80:80 --name some-nginx -v ~/nginx/www:/opt/www -v ~/nginx/logs:/var/log/nginx -v ~/nginx/docker-etc-nginx:/etc/nginx nginx

...稍后修改完善步骤

软件安装:

#更新软件源列表
apt update

#安装docker,在Ubuntu平台叫docker.io/旧称,现称docker-ce
apt install docker-ce/ or docker.io

#安装python3、python3-pip
apt install python3 python3-pip

#通过pip安装docker-compose
pip3 install docker-compose

#安装ACME.SH
curl https://get.acme.sh | sh
source ~/.bashrc

#重启

使用docker启动应用:

配置域名、Https

配置back.sh

相关参考:

https://docs.docker.com/engine/install/ubuntu/
使用acme.sh申请Let's Encrypt通配符证书
Linux screen命令

next do

可以适当选择性的安装nextcloud,做自己的文件存储和图片存储(有时候需要配图
也可以另外安装科学上网的相关软件

命令行记录:

#开启终端分屏(session 后台维持)
screen -S lamp

#lamp安装流程
./lamp sh

+-------------------------------------------------------------------+
| Auto Install LAMP(Linux + Apache + MySQL/MariaDB/Percona + PHP ) |
| Website: https://lamp.sh |
| Author : Teddysun  |
+-------------------------------------------------------------------+

--------------------- System Information ----------------------------

CPU model : Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
Number of cores : 2
CPU frequency : 3199.888 MHz
Total amount of ram : 3936 MB
Total amount of swap : 2047 MB
System uptime : 7days, 12:4:44
Load average : 0.22, 0.09, 0.03
OS : Ubuntu 20.04 LTS
Arch : x86_64 (64 Bit)
Kernel : 5.4.0-39-generic
Hostname : vmi411360.contaboserver.net
IPv4 address : 62.171.166.193

---------------------------------------------------------------------

-------------------------- apache setting ---------------------------

1. httpd-2.4.43
2. do_not_install

which apache you'd select (default httpd-2.4.43): 1/默认

your selection: httpd-2.4.43

-------------------------- apache_modules install --------------------------

1. mod_wsgi-4.7.1
2. mod_security-3.0.4
3. mod_jk-1.2.46
4. do_not_install

Please input one or more number between 1 and 4 (default do_not_install) (for example: 1 2 3): 4/默认

your selection: do_not_install

-------------------------- mysql setting ---------------------------

1. mysql-5.5.62
2. mysql-5.6.48
3. mysql-5.7.30
4. mysql-8.0.20
5. mariadb-5.5.68
6. mariadb-10.0.38
7. mariadb-10.1.45
8. mariadb-10.2.32
9. mariadb-10.3.23
10. mariadb-10.4.13
11. Percona-Server-5.5.62-38.14
12. Percona-Server-5.6.48-88.0
13. Percona-Server-5.7.30-33
14. Percona-Server-8.0.16-7
15. do_not_install

which mysql you'd select (default mysql-5.7.30): 4/选择mysql8

your selection: mysql-8.0.20

mysql data location(default:/usr/local/mysql/data, leave blank for default):

mysql data location: /usr/local/mysql/data

mysql server root password (default:lamp.sh, leave blank for default):

mysql server root password: lamp.sh

-------------------------- php setting ---------------------------

1. php-5.6.40
2. php-7.0.33
3. php-7.1.33
4. php-7.2.31
5. php-7.3.19
6. do_not_install

which php you'd select (default php-7.3.19): 5

your selection: php-7.3.19

php-7.3.19 available modules:

-------------------------- php_modules install --------------------------

1. ioncube_loaders
2. php-imagick-3.4.4
3. php-gmagick-2.0.5RC1
4. php-memcached-3.1.5
5. php-redis-5.2.1
6. php-mongodb-1.7.4
7. libsodium-php-2.0.22
8. php-swoole-4.4.18
9. yaf-3.2.2
10. xdebug-2.9.5
11. do_not_install

Please input one or more number between 1 and 11 (default do_not_install) (for example: 1 2 3): 2

your selection: imagick-3.4.4

-------------------------- phpmyadmin install --------------------------

1. phpMyAdmin-4.9.5-all-languages
2. adminer-4.7.7
3. do_not_install

Please input one or more number between 1 and 3 (default phpMyAdmin-4.9.5-all-languages) (for example: 1 2 3): 1

your selection: phpMyAdmin-4.9.5-all-languages

-------------------------- kodexplorer setting ---------------------------

1. kodexplorer-4.35
2. do_not_install

which kodexplorer you'd select (default kodfile-4.35): 2

------------------------- Install Overview --------------------------

Apache: httpd-2.4.43
Apache Location: /usr/local/apache

Database: mysql-8.0.20
MySQL Location: /usr/local/mysql
MySQL Data Location: /usr/local/mysql/data
MySQL Root Password: lamp.sh

Database Management Modules:
phpMyAdmin-4.9.5-all-languages

PHP: php-7.3.19
PHP Location: /usr/local/php
PHP Additional Extensions:
imagick-3.4.4

KodExplorer: do_not_install

---------------------------------------------------------------------

Press any key to start...or Press Ctrl+C to cancel

Starting to install development tools...
Starting to install package gcc
Starting to install package g++
Starting to install package make
Starting to install package wget
Starting to install package perl
Starting to install package curl
Starting to install package bzip2
Starting to install package libreadline-dev
Starting to install package net-tools
Starting to install package python
Starting to install package python-dev
Starting to install package cron
Starting to install package ca-certificates
Starting to install package ntpdate
Install development tools completed...
Starting to sync time...
8 Jul 10:40:53 ntpdate[11817]: ntpdate [email protected] (1)
8 Jul 10:41:02 ntpdate[11817]: step time server 116.203.151.74 offset -0.001170 sec
Sync time completed...
Start time: 2020-07-08 10:41:02
Starting remove the conflict packages...
Remove the conflict packages completed...
Starting to install dependencies packages for Apache...
Starting to install package zlib1g-dev
Starting to install package openssl
Starting to install package libssl-dev
Starting to install package libxml2-dev
Starting to install package lynx
Starting to install package lua-expat-dev
Starting to install package libjansson-dev
Install dependencies packages for Apache completed...
...check & config dependencies
#还是蛮多的/选择恐惧症了

#挂起终端session
Ctrl + A + D
#等待约20分钟...
#基于不同的机器配置
#所以有实力的话还是docker配置安装快速和稳定一些,还能起到环境隔离

# php ,bug,ubuntu 系统不要使用18.04以上的

Leave a Reply