Initial Server Setup with Ubuntu 12.04
Initial Server Setup with Ubuntu 12.04 Tutorial
If you are setting up a new Ubuntu 12.04 server, it is important to follow the proper steps to ensure that your server is secure and ready to use. In this tutorial, we will guide you through the initial server setup process.
Step 1: Log in as a Root User
To begin the setup process, log in to your server as the root user. If you do not have root access, you can use the sudo command to run commands with administrative privileges.
Step 2: Update the System
Next, update the system to ensure that you have the latest security patches and software updates. Run the following command:
sudo apt-get update && sudo apt-get upgrade
Step 3: Create a New User
It is not recommended to use the root user for regular tasks, so create a new user with sudo privileges. Run the following command to create a new user:
adduser newuser
Replace "newuser" with your desired username.
Step 4: Set Up SSH Keys
SSH keys are a more secure way of logging in to your server than using a password. Generate a new SSH key pair on your local machine with the following command:
ssh-keygen -t rsa
Copy the contents of the public key file to your server with the following command:
ssh-copy-id newuser@server_ip_address
Replace "newuser" with your new username and "server_ip_address" with your server's IP address.
Step 5: Disable Root Login
For security reasons, it is recommended to disable root login. Open the SSH configuration file with the following command:
sudo nano /etc/ssh/sshd_config
Find the line that says "PermitRootLogin" and change it to:
PermitRootLogin no
Save and exit the file. Restart the SSH service with the following command:
sudo service ssh restart
Step 6: Install Firewall
Install a firewall to protect your server from unauthorized access. Run the following command to install the Uncomplicated Firewall (UFW):
sudo apt-get install ufw
Enable the firewall with the following command:
sudo ufw enable
Комментарии
Отправить комментарий