Source:
- https://askubuntu.com/questions/1029531/how-to-setup-a-static-ip-on-ubuntu-server-18-04
- https://www.freecodecamp.org/news/setting-a-static-ip-in-ubuntu-linux-ip-address-tutorial/
- https://linuxconfig.org/setting-a-static-ip-address-in-ubuntu-24-04-via-the-command-line
Find your interface name
ip address showEdit / create the cloud-init network configuration file
sudo nano /etc/cloud/cloud.cfg.d/50-curtin-networking.cfgor
sudo nano /etc/netplan/51-my-network-yamlTo set a static IP address, use the addresses key, which takes a list of (IPv4 or IPv6), addresses along with the subnet prefix length (e.g. /24). Gateway and DNS information can be provided as well:
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.1.9/24
gateway4: 192.168.1.1
nameservers:
addresses: [192.168.1.1, 8.8.8.8, 8.8.4.4]
You can find more configuration options at https://netplan.io/examples
Reload the cloud-init configuration. This will reboot your server.
sudo cloud-init clean -ror
sudo netplan applySource:
Create a file:
sudo nano /etc/systemd/system/enable-console-blanking.serviceAnd put this into the file:
[Unit]
Description=Enable virtual console blanking
[Service]
Type=oneshot
Environment=TERM=linux
StandardOutput=tty
TTYPath=/dev/console
ExecStart=/usr/bin/setterm -blank 1
[Install]
WantedBy=multi-user.target
Then change the file rights and enable the service:
sudo chmod 664 /etc/systemd/system/enable-console-blanking.service
sudo systemctl enable enable-console-blanking.serviceAnd reboot the server. Now the screens blanks after 1 minute without keypresses, even before the login.
Source:
sudo vi /etc/default/console-setupedit content: FONTSIZE="16x32"
Save, exit and reboot.
Source:
Add:
video=HDMI-A-1:1920x1080M@60
as a parameter to the kernel.
Source:
When using systemd: This example assumes you are using a APC Smart-UPS 750 via USB.
First, install the apcupsd package via a terminal:
sudo apt-get -y install apcupsdNext, backup the original configuration files:
sudo cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.bakNext, edit the configuration files:
sudo nano /etc/apcupsd/apcupsd.confUPSNAME smartups750
UPSCABLE usb
UPSTYPE usb
DEVICE
POLLTIME 60
sudo cp /etc/default/apcupsd /etc/default/apcupsd.baksudo nano /etc/default/apcupsdISCONFIGURED=yesNow one may check the status of the UPS via a terminal:
apcaccess statusAPC : 001,027,0660
DATE : 2015-09-26 18:39:09 -0500
HOSTNAME : pc
VERSION : 3.14.12 (29 March 2014) debian
UPSNAME : smartups750
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2015-09-26 18:39:08 -0500
MODEL : Smart-UPS 750
STATUS : ONLINE
BCHARGE : 100.0 Percent
TIMELEFT : 51.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
ALARMDEL : 30 Seconds
BATTV : 27.1 Volts
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000008
MANDATE : 2010-07-08
SERIALNO : XXXXXXXXXXXX
NOMBATTV : 24.0 Volts
FIRMWARE : COM 02.1 / UPS.05.D
END APC : 2015-09-26 18:39:19 -0500
In order to run apctest, one must first stop apcupsd via a terminal:
sudo systemctl stop apcupsdOtherwise, one may see the following error:
sudo apctest2015-09-26 18:57:38 apctest 3.14.12 (29 March 2014) debian
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
apctest FATAL ERROR in apctest.c at line 335
Unable to create UPS lock file.
If apcupsd or apctest is already running,
please stop it and run this program again.
apctest error termination completed
Then execute:
sudo apctest2015-09-26 18:59:38 apctest 3.14.12 (29 March 2014) debian
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...
You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.
Getting UPS capabilities...SUCCESS
Please select the function you want to perform.
1) Test kill UPS power
2) Perform self-test
3) Read last self-test result
4) View/Change battery date
5) View manufacturing date
6) View/Change alarm behavior
7) View/Change sensitivity
8) View/Change low transfer voltage
9) View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
Q) Quit
Select function number:
Once done, start apcupsd:
sudo systemctl start apcupsdSource:
Source:
If NGINX is not already installed on your server, you can install it using the package manager of your Linux distribution. For Ubuntu or Debian-based systems, use the following commands:
sudo apt update
sudo apt install nginxEnsure NGINX is running and set to start on boot using the systemctl commands:
sudo systemctl start nginx
sudo systemctl enable nginxCreate a directory structure for your website files. This is where you will store your website's content. Use your actual domain name in place of 'your_domain':
sudo mkdir -p /var/www/your_domain/htmlAssign ownership and set the correct permissions:
sudo chown -R $USER:$USER /var/www/your_domain/html
sudo chmod -R 755 /var/wwwCreate a new configuration file in the /etc/nginx/sites-available/ directory. This file will contain the server block settings for your domain:
sudo nano /etc/nginx/sites-available/your_domainInsert the following configuration, ensuring you replace 'your_domain' with your actual domain name and adjust the document root if necessary:
server {
listen 80;
server_name your_domain www.your_domain;
root /var/www/your_domain/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
Activate the server block by linking the file you just created to the sites-enabled directory:
sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/It's crucial to test your NGINX configuration for any syntax errors before restarting the service:
sudo nginx -tIf the configuration test is successful, restart NGINX to apply the changes:
sudo systemctl restart nginxIf you're using a firewall, ensure that HTTP and HTTPS traffic are permitted.
For UFW users:
sudo ufw allow 'Nginx HTTP'For firewalld users:
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload