受欢迎的博客标签

How To Install and uninstall reinstall certbot on Ubuntu 18.04(aliyun)

Published

 Install certbot

os:Ubuntu 18.04.3 LTS

# lsb_release -a
LSB Version:	core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

Use apt-get to install certbot. The installer creates a systemd init script that runs certbot as daemon on system startup. Follow the installation instructions for Ubuntu as follow:

sudo apt update
sudo apt install certbot

output

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]         
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]                     
Fetched 252 kB in 0s (531 kB/s)                                                                  
Reading package lists... Done
...

Setting up python3-acme (0.31.0-2~ubuntu18.04.1) ...
Setting up python3-certbot (0.27.0-1~ubuntu18.04.2) ...
Setting up certbot (0.27.0-1~ubuntu18.04.2) ...
Created symlink /etc/systemd/system/timers.target.wants/certbot.timer → /lib/systemd/system/certbot.timer.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
 ...
certbot --version

output

certbot 0.27.0

 

Uninstall  Nginx on Ubuntu 18.04(aliyun)

step 1:

sudo apt-get remove nginx nginx-common # Removes all but config files.

or

sudo apt-get purge nginx nginx-common # Removes everything

step 2:

sudo apt-get autoremove # After using any of the above commands, use this in order to remove dependencies used by nginx which are no longer required.

 

Reinstall

To recreate it, first uninstall using purge to remove even configuration files and records:

# Run these commands as your normal login (e.g. "michael")
# Remove any existing versions of nginx
sudo apt-get remove '^nginx.*$'
 
# Setup a sources.list.d file for the nginx repository
cat << 'EOF' | sudo tee /etc/apt/sources.list.d/nginx.list
deb http://nginx.org/packages/ubuntu/ precise nginx
deb-src http://nginx.org/packages/ubuntu/ precise nginx
EOF
 
# Add nginx key
curl http://nginx.org/keys/nginx_signing.key | sudo apt-key add -
 
# install nginx
sudo apt-get update && sudo apt-get -y install nginx

then reinstall:

apt-get install nginx

Host ASP.NET Core on Linux with Nginx

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.0