Ubuntu 22.04 setup chyrp lite environment and more

You must have known that I just migrated this blog site to a VPS hosted on oracle cloud, while this wiki page is too brief to get a workable environment easily.

Here is the note for this migration.

  1. sudo -i
  2. Install packages that chyrp will need
    apt install php8.1 php8.1-xml php8.1-fpm php8.1-mysql php8.1-mbstring mysql-server nginx certbot python3-certbot-nginx
  1. Set a password for 'root'@'localhost' account on this new mysql server
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_password';
    FLUSH PRIVILEGES;
  1. Run mysql_secure_installation to
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database and access to it
  1. Create a common user for the blog database, and the blog database
    CREATE USER 'blog'@'localhost' IDENTIFIED BY 'superdifficultpassword';
    GRANT ALL PRIVILEGES ON blog.* To 'blog'@'localhost' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    CREATE DATABASE `blog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;
  1. Put .my.cnf with the following content in home directory
[client]
user=blog
password=yoursuperdifficultpassword
host=localhost
  1. Restore the database backup
    mysql blog < blog_20230408-030501.sql
  1. Setup nginx and https certificate with certbot
  2. Setup renew the certificate by crontab
SHELL=/usr/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15 0 * * * /usr/bin/certbot --nginx renew > /dev/null
  1. Restore previous installation, overwrite with the latest version, do the upgrade, that's it!

Comments

  1. Markdown is allowed. HTML tags allowed: <strong>, <em>, <blockquote>, <code>, <pre>, <a>.