Setting up a server
Server provisioning: from bare metal to operational server
A server without provisioning is an expensive box of metal. This article explains how provisioning works, which steps the process includes, and how to automate it with tools like Ansible and Terraform — for administrators who want to deliver servers consistently and reproducibly.
REQUIREMENTS
- A physical server, virtual machine, or cloud instance with at least 2 CPU cores, 4 GB RAM, and 20 GB storage
- SSH access to the server (port 22)
- An operating system of your choice: Ubuntu 22.04 LTS, CentOS Stream 9, or SUSE Linux Enterprise Server 15 SP5
- For automation: Ansible 2.14 or higher, or Terraform 1.5 or higher on your management system
- Root or sudo privileges on the target server
1. Install the operating system
For physical servers, you install the OS via a bootable USB stick, an ISO image, or a PXE network installation. For virtual servers and cloud instances, you choose a template or image in the platform — for example, an Ubuntu 22.04 cloud image in AWS EC2 or KVM. Make sure you set a strong root password during installation or add an SSH key.
2. Configure the network environment
Set the IP address, subnet mask, gateway, and DNS servers. On Ubuntu 22.04, you edit the file `/etc/netplan/01-netcfg.yaml`:
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4Apply the file with `sudo netplan apply`. Then set the hostname with `sudo hostnamectl set-hostname webserver01`. Configure time synchronization with NTP via `sudo timedatectl set-ntp true`.
3. Assign hardware resources
For virtual servers, you assign CPU, memory, storage, and network bandwidth via the hypervisor or cloud platform. With VMware you use vSphere, with KVM `virsh`, with AWS EC2 you choose an instance type such as t3.medium. For bare-metal servers, the physical hardware determines the resources — but you still need to determine which resources go to which roles, for example, 4 GB RAM for the database and 2 GB for the web server.
4. Install the required services
Install the software the server needs to perform its task. For a web server on Ubuntu 22.04:
sudo apt update
sudo apt install -y nginx mysql-server openssh-server
sudo systemctl enable --now nginx
sudo systemctl enable --now mysqlFor a database server, you install PostgreSQL 15 or MySQL 8.0. For an application server, you install the runtime you need, such as Node.js 20 or Python 3.11. The SSH daemon is present by default on most Linux distributions — check that it is running with `sudo systemctl status ssh`.
5. Automate with infrastructure as code
Use Ansible to capture the configuration in code. Create a playbook, for example `provision.yml`:
---
<ul><li>name: Provision web server</li></ul>
hosts: webservers
become: yes
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Start nginx
service:
name: nginx
state: started
enabled: yes
- name: Set hostname
hostname:
name: "{{ inventory_hostname }}"Run the playbook with `ansible-playbook -i inventory provision.yml`. For cloud infrastructure, you use Terraform to describe the infrastructure itself — for example, an EC2 instance or a KVM guest — and Ansible for the configuration on top of it.
6. Set up monitoring, logging, and backups
Install and configure monitoring agents such as Prometheus Node Exporter or Zabbix agent. Configure log forwarding to a central log server with rsyslog or Filebeat. Set up backups with `cron` and `rsync` or tools like Bacula. An example of a cron job for daily database backups:
0 2 <em> </em> * mysqldump -u root -p'password' mydatabase > /backups/mydatabase_$(date +\%Y\%m\%d).sqlSet up update routines with `unattended-upgrades` on Ubuntu or `dnf-automatic` on CentOS Stream.
7. Register the server in the management system
Add the server to your configuration management database (CMDB) or your cloud management platform. With BMC Cloud Lifecycle Management, you perform the preparatory tasks in BMC Server Automation and then link the server to the cloud management system. Assign the server to an environment (test, staging, or production) and link the security policy.
8. Perform a final check
Restart the server to verify that all services start automatically. Check that the server is reachable on the network and that all services are running correctly.
VERIFICATION
Check that the server is fully operational:
ssh user@server-ip
hostname
ip addr show
systemctl status nginx
systemctl status mysql
curl -I http://localhostIf you have set up a web server, the `curl` command should return an HTTP 200 status. Also check that the monitoring agent is sending data to your central monitoring system and that the first backup has been completed successfully.
COMMON PROBLEMS
1. Network does not work after configuration
Check whether the network configuration is correct with `ip addr show` and `ip route show`. Test the connection with `ping 8.8.8.8`. If DNS does not work, check the nameservers in `/etc/resolv.conf`. On Ubuntu 22.04, Netplan can overwrite the configuration — check whether you have run `netplan apply`.
2. Services do not start after reboot
Check whether the services are enabled with `systemctl is-enabled nginx`. If they are not enabled, use `sudo systemctl enable nginx`. Also check whether the services use conflicting ports with `sudo ss -tulpn`.
3. Ansible playbook fails with SSH error
Check whether the SSH key has been added to `~/.ssh/authorized_keys` on the target server. Test the connection manually with `ssh user@server-ip`. Check whether the user has sudo rights without a password — add to `/etc/sudoers.d/` with `visudo`.
CONCLUSION
Server provisioning does not stop at installing an OS — it is an ongoing process of configuration, automation, and management that makes every server identical and predictable. The next time you deliver a server, the work only really begins.