Installing Core Services

Setting the fully qualified domain name

Before doing anything else, give the server a fully-qualified domain name. This will make it easier to refer to and is an essential prerequisite to installing Virtualmin.

First create the A/AAAA DNS records pointing to the name you have chosen. You well need to refer to your DNS provider to find out how do to this. Then, on the server


sudo hostnamectl set-hostname your.fqdn
Then edit /etc/hosts to add the following lines:

127.0.0.1 your.fqdn yourhostname
::1 your.fqdn yourhostname #only if you are using IPv6.

If your server has a static IP address, replace 127.0.0.1 with the server’s actual IPv4 address and ::1 with your actual IPv6 address.

Then restart the hostname daemon and verify the changes:


sudo systemctl restart systemd-hostnamed
hostnamectl
hostname -f
  

hostnamectl should show the updated hostname, and hostname -f should display the fully-qualified domain name.

Set the default name servers

Find your connection name:


nmcli connection show
  

Set the DNS servers:


sudo nmcli connection modify your-connection-name ipv4.dns "1.1.1.1 8.8.8.8"
sudo nmcli connection modify your-connection-name ipv4.ignore-auto-dns yes
sudo nmcli connection modify your-connection-name ipv6.dns "2606:4700:4700::1111 2001:4860:4860::8888"
sudo nmcli connection modify your-connection-name/em> ipv6.ignore-auto-dns yes

  

Reactivate the connection:


sudo nmcli connection down your-connection-name
sudo nmcli connection up your-connection-name
  

Installing Virtualmin/Webmin

Virtualmin provides a web interface for administering the server. It makes a lot of tasks simpler and less error prone. However, it must be the first thing that’s installed on a clean linux installation. The Virtualmin installation process will set up and configure more services so you don’t have to.

The full installation instructions for Vitrualmin are online, so I won’t repeat them here.

You access Virtualmin at https://your.website:10000. Note that Virtualmin users are not the same as linux users (although you can configure Virtualmin to use the same credentials).

Install/enable additional repos

The Remi repo contains more recent versions of php. the CRB repo contains packages needed for Sympa


sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
sudo dnf config-manager --set-enabled crb

Upgrade PHP to the latest version

As I write this, the most recent stable version is 8.4. Modify the instructions for the current stable release.

The latest release isn’t in the standard repositories so you need to add the Remi repo (which may have already been added by Virtualmin).

Then we reset php and install the latest version, along with core modules. Finally update anything else that’s new.


sudo dnf module reset php -y
sudo dnf module enable php:remi-8.4 -y
sudo dnf install -y php-cli php-common php-curl php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pecl-imagick php-xml php-zip
sudo dnf update
sudo dnf upgrade
php -v # Check the version

Install Cockpit

While Virtualmin does most things we need, Cockpit can be useful, too. So let’s install that.

dnf install cockpit
systemctl enable cockpit.socket --now

You access Cockpit at https://your.website:9090. Unlike Virtualmin, Cockpit uses your linux login credentials.

By default Cockpit uses a locally signed certificate. We can address that later.

Install WP-CLI

WP-CLI is very useful in administering WordPress.

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
  

Install the redis object cache

Redis caches static content making web pages faster. It is in the Remi repo we added earlier.


sudo dnf module enable redis:remi-7.0 -y
sudo dnf install redis -y
sudo systemctl enable --now redis
To check redis is installed and running, enter redis-cli at the command line, then ping. Redis should respond, PONG. Then quit.

Install node and set the version

Install the mode environment


dnf module enable nodejs:22 -y
dnf module switch-to nodejs:22 -y
dnf install nodejs
To check redis is installed and running, enter redis-cli at the command line, then ping. Redis should respond, PONG. Then quit.

Update .bashrc

.bashrc is the file that customises the command line shell. There is one per user. I suggest customising it for yourself and for root (the linux superuser). Using your preferred editor, add the following to your .bashrc file. Add the same lines to ~root/.bashrc but change 32 to 31 to give root a red prompt. Red for danger! Note that root already has the alias’s defined so you don’t need to add them again.


# add local bin directories to the path
if ! [[ "$PATH" =~ "/usr/local/bin:" ]]
then
    PATH="$PATH:/usr/local/bin:/usr/local/sbin"
fi

# Set the prompt
PS1='\[\e[0;32m\]\u@\h:\w$ \[\e[0m\]'
#32 above is green, 31 is red

#Some useful aliases - these are already there for root.
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'