Prepare the Server
A few system packages are needed:
- Curl: used to downloading the install
- Nginx: used as a webserver proxy
- Pm2: used as the requests runner
- Node 18: the website is build in node
- Pnpm: used to install node packages
- Dotnev: used to pass variables into the site
- Lsof: (ubuntu, centos); needed to check open ports
- Git: (ubuntu, centos); needed for installs
- Grep: (apline); need to update default version
- System build tools
Note
Many of the commands below require root access. If you are not a root user, run them with
sudo.
∞ Install Deps
apt-get update
apt-get -y install curl nginx lsof build-essential git
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get install -y nodejs
corepack enable
corepack prepare "[email protected]+sha512.stwg4vxys+GISEWbNzWaMgZGY+VielHkx0ssKd2OjgSRSDw6u0B4nP1Xi/Ni+2uoJhsF8Dh9dnku1uI+o7G2oA==" --activate
pnpm i -g pm2 dotenv-cli
pm2 install pm2-logrotate
# allow pm2 to start on reboot (need sudo if you are not running as root)
pm2 startup
apk add --no-cache curl nginx nodejs npm grep
corepack enable
corepack prepare "[email protected]+sha512.stwg4vxys+GISEWbNzWaMgZGY+VielHkx0ssKd2OjgSRSDw6u0B4nP1Xi/Ni+2uoJhsF8Dh9dnku1uI+o7G2oA==" --activate
pnpm i -g pm2 dotenv-cli
pm2 install pm2-logrotate
# allow pm2 to start on reboot (need sudo if you are not running as root)
pm2 startup
∞ Update Report Lists
# mirror streams may need to be updated.
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*
# add source for latest curl (default older curl is missing flags)
cat > /etc/yum.repos.d/city-fan.repo << EOF
[CityFan]
name=City Fan Repo
baseurl=http://www.city-fan.org/ftp/contrib/yum-repo/rhel\$releasever/\$basearch/
enabled=1
gpgcheck=0
EOF
yum clean all
yum install -y curl
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
yum -y install nodejs nginx lsof git gcc gcc-c++ make
corepack enable
corepack prepare "[email protected]+sha512.stwg4vxys+GISEWbNzWaMgZGY+VielHkx0ssKd2OjgSRSDw6u0B4nP1Xi/Ni+2uoJhsF8Dh9dnku1uI+o7G2oA==" --activate
pnpm i -g pm2 dotenv-cli
pm2 install pm2-logrotate
# allow pm2 to start on reboot (need sudo if you are not running as root)
pm2 startup
You can check the node version by running node --version.