
How To Launch Your Site on a New Ubuntu 24.04 Server with LAMP, SFTP, and DNS
Launching a new website can be an exciting venture, but it can also be a bit daunting, especially if you’re not familiar with the technical aspects. At Greenhost.cloud, we make it our mission to simplify the process of getting your site up and running. In this blog post, we will guide you through the steps to launch your site on a new Ubuntu 24.04 server, including setting up a LAMP stack, configuring SFTP for secure file transfers, and managing DNS settings. Let’s dive in!
Step 1: Setting Up Your Ubuntu 24.04 Server
1.1 Initial Server Setup
First, you’ll need to access your newly provisioned Ubuntu 24.04 server. You can use SSH to log into your server. Open a terminal and type the following command:
ssh your_username@your_server_ipReplace your_username and your_server_ip with your actual username and server IP address.
1.2 Update Your System
Once logged in, ensure that your system is up-to-date by running:
sudo apt update && sudo apt upgrade -yStep 2: Installing the LAMP Stack
The LAMP stack comprises Linux, Apache, MySQL (or MariaDB), and PHP. It’s a popular combination for hosting dynamic websites.
2.1 Install Apache
To install Apache, use the following command:
sudo apt install apache2 -yOnce installed, you can check if Apache is running by entering your server’s IP address in your web browser. You should see the Apache default page.
2.2 Install MySQL or MariaDB
Next, we need a database server. You can install MySQL or MariaDB; we’ll use MySQL here:
sudo apt install mysql-server -yRun the security script to secure your installation:
sudo mysql_secure_installationFollow the prompts to set root passwords and remove insecure settings.
2.3 Install PHP
To install PHP along with some common extensions, use the following command:
sudo apt install php libapache2-mod-php php-mysql -y2.4 Test PHP
Create a test PHP file to ensure it’s working:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.phpVisit http://your_server_ip/info.php in your web browser to check if PHP is successfully running.
Step 3: Configuring SFTP
Secure File Transfer Protocol (SFTP) allows you to securely transfer files to your server.
3.1 Create a New User
For security reasons, create a new user for SFTP access:
sudo adduser newusernameReplace newusername with your desired username.
3.2 Grant SFTP Access
Open the SSH configuration file:
sudo nano /etc/ssh/sshd_configAdd the following lines at the end of the file to configure a new SFTP group:
Match User newusername
ForceCommand internal-sftp
ChrootDirectory /home/newusername
AllowTcpForwarding noSave and exit, then restart SSH:
sudo systemctl restart sshd3.3 Set the Directory Permissions
Set the permissions for the user home directory:
sudo chown root:root /home/newusername
sudo mkdir /home/newusername/uploads
sudo chown newusername:newusername /home/newusername/uploadsNow, your new user can connect using an SFTP client like FileZilla.
Step 4: Setting Up DNS
To point your domain to your new server, you need to configure DNS settings:
4.1 Access Your Domain Registrar
Log into your domain registrar’s control panel.
4.2 Update A Record
Find the DNS management section and add an A record pointing your domain to the IP address of your server. For example:
- Type: A
- Host: @
- Value: your_server_ip
- TTL: 3600
4.3 Verify DNS Propagation
You can check if your DNS changes have propagated using tools like whatsmydns.net to ensure that your domain resolves to your server’s IP.
Conclusion
Congratulations! You’ve successfully launched your site on a new Ubuntu 24.04 server with LAMP, configured SFTP for secure file transfers, and managed your DNS settings. Now you can start working on developing your website, knowing you have a solid foundation in place.
At Greenhost.cloud, we are committed to helping you with every step of your online journey. If you have any questions or need further assistance, feel free to reach out to our support team!
Happy hosting!