Category: Step-by-Step Guides

  • 🐧 How to Host a Website on Linux from Scratch: A Step-by-Step Guide

    Whether you’re a developer, freelancer, or small business owner, learning how to host a website on a Linux server gives you full control, scalability, and cost-efficiency. In this guide, we’ll walk you through hosting your own website on a Linux VPS or dedicated server — from setup to deployment.

    This process is 100% hands-on and ideal for anyone using platforms like VavenCloud, where Linux servers are the backbone of custom web hosting.


    📦 Prerequisites

    Before we dive in, here’s what you’ll need:

    • A Linux-based server (Ubuntu 20.04+ is recommended)
    • Root or sudo access
    • A registered domain name
    • Basic knowledge of terminal commands
    • SSH client (like PuTTY or your terminal)

    1. 🔐 Connect to Your Linux Server via SSH

    From your local machine, open a terminal and connect to your server:

    ssh username@your_server_ip

    Replace username (often root) and your server’s IP. If this is your first time, you’ll be prompted to accept the SSH key and enter your password.


    2. 🧹 Update Your System Packages

    Keep your server secure and up-to-date:

    sudo apt update && sudo apt upgrade -y

    This ensures all software packages are current and vulnerabilities are patched.


    3. 🌐 Install a Web Server (Apache or Nginx)

    Option 1: Apache

    sudo apt install apache2 -y

    Start and enable the service:

    sudo systemctl enable apache2
    sudo systemctl start apache2

    Option 2: Nginx

    sudo apt install nginx -y
    sudo systemctl enable nginx
    sudo systemctl start nginx

    Test by visiting http://your_server_ip — you should see a welcome page.

    4. 💾 Upload Your Website Files

    You can use SCP, SFTP, or Git to upload your HTML/CSS/JS files. Here’s an example using SCP:

    scp -r /local/path/to/your/site username@your_server_ip:/var/www/html

    Make sure your files are placed in the correct web root. By default:

    • Apache: /var/www/html/
    • Nginx: depends on your config, usually /usr/share/nginx/html/

    Set correct permissions:

    sudo chown -R www-data:www-data /var/www/html

    5. 🌍 Configure Your Domain (DNS Setup)

    Update your domain’s DNS records to point to your server’s IP address:

    • A Record → your server’s IP (e.g. example.com → 192.0.2.1)
    • CNAME or www → example.com

    Propagation may take up to 24 hours.


    6. 🔒 Install SSL with Let’s Encrypt (Optional but Recommended)

    Install Certbot:

    sudo apt install certbot python3-certbot-apache -y

    Run it to secure your domain:

    sudo certbot –apache

    For Nginx, replace --apache with --nginx.

    Auto-renewal is set up by default, but you can verify with:

    sudo certbot renew –dry-run

    7. 🚀 Final Test

    Open your browser and navigate to your domain (e.g. https://yourdomain.com). Your website should be live, secure, and running on your Linux server!


    🔁 Bonus: Automate with VavenCloud

    Manually hosting is a great learning experience — but if you want to speed up deployments, scale effortlessly, and add CI/CD out of the box, VavenCloud can automate much of this setup.

    With VavenCloud’s DevOps suite, you get:

    • Pre-configured Linux VPS
    • One-click website deployment
    • Built-in SSL, backups, and domain tools
    • Git-based CI/CD pipelines for automatic publishing

    🧠 Final Thoughts

    Hosting a website on Linux from scratch teaches you the building blocks of web infrastructure — something every developer should try at least once. But when it’s time to go from DIY to production-grade, platforms like VavenCloud help you scale securely, reliably, and without hassle.


    Want to try VavenCloud’s hosting platform?
    👉 Get started here

     

  • How to Install ERPNext on Ubuntu: A Complete Walkthrough for Beginners

    Introduction

     

    Are you running a small or medium enterprise and looking for a way to integrate your essential business processes? ERPNext, a free and open-source Enterprise Resource Planning (ERP) solution, can streamline your operations by centralizing and automating key functions. This guide will walk you through the step-by-step process of installing ERPNext on your Ubuntu server, unlocking enhanced efficiency and productivity for your team.

    What is ERPNext?

    ERPNext is a robust, open-source ERP platform designed to simplify and automate business operations. It offers integrated tools for accounting, inventory management, customer relationship management (CRM), human resources, and project management. By centralizing data, providing real-time insights, and enabling seamless collaboration, ERPNext is a flexible and cost-effective solution for businesses of all sizes.

    Prerequisites

    • Ubuntu Server: A fresh installation of Ubuntu 22.04.

    • Hardware: Minimum 2 CPU cores, 4GB RAM, and 20GB SSD storage (SSD recommended for best performance).

    • Timezone: Ensure your server’s timezone matches your location. Check with:

    date

    If needed, update the timezone:

    sudo timedatectl set-timezone "TIMEZONE"

    Replace TIMEZONE with your region, such as Asia/Kolkata or Europe/Copenhagen.

    Step-by-Step Installation

    1. Update System Packages

    Start by updating all existing packages:

    sudo apt-get update && sudo apt-get upgrade -y

    2. Create a New User

    Replace yourusername with your preferred username:

    sudo adduser yourusername
    sudo usermod -aG sudo yourusername
    su yourusername
    cd /home/yourusername/

    This helps keep your system secure by avoiding root user exposure.

    3. Install Essential Packages

    • Fail2ban: Protects your server from unauthorized access:

    sudo apt-get install fail2ban -y
    sudo systemctl start fail2ban
    • Supervisor: Manages long-running processes:
    sudo apt update && sudo apt install supervisor -y
    • Git: Version control system:
    sudo apt-get install git -y
    git --version
    • Python: Required for ERPNext dependencies:
    sudo apt-get install python3-dev python3.10-dev python3-setuptools python3-pip python3-distutils python3.10-venv -y
    python3 -V
    • MariaDB: Preferred database for ERPNext:
    sudo apt install mariadb-server mariadb-client -y
    • cURL: For transferring files:
    sudo apt install curl -y
    • Node.js: For JavaScript runtime:
    curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
    sudo -E bash nodesource_setup.sh
    sudo apt install nodejs -y
    sudo npm install -g yarn
    node --version
    • Redis: For caching:
    sudo apt-get install redis-server -y
    sudo systemctl start redis-server.service
    • Additional Utilities:
    sudo apt-get install software-properties-common -y
    sudo apt-get install libmysqlclient-dev -y
    sudo apt-get install xvfb libfontconfig wkhtmltopdf -y

    4. Configure MariaDB

    • Secure your database installation:
    sudo mysql_secure_installation
    Answer the prompts as needed, except for “Disallow root login remotely?”—select N to allow remote access if required.
    • Edit the MySQL configuration file:
    sudo nano /etc/mysql/my.cnf
    Add the following lines at the end:
    
    [mysqld]
    character-set-client-handshake = FALSE
    character-set-server = utf8mb4
    collation-server = utf8mb4_unicode_ci
    
    [mysql]
    default-character-set = utf8mb4
    
    
    • Save and restart MySQL:
    sudo service mysql restart

    5. Install Frappe Bench

    • Frappe Bench is a command-line tool for managing ERPNext installations:
    sudo pip3 install frappe-bench
    bench --version
    bench init --frappe-branch version-15 frappe-bench
    cd /home/yourusername/frappe-bench/
    chmod -R o+rx /home/yourusername/

    6. Create a New Site

    • Replace mysite with your preferred site name:
    bench new-site mysite.local
    • Set your MySQL root password and an admin password when prompted.

    7. Install ERPNext and Modules

    • Install the payments app and ERPNext:
    bench get-app payments
    bench get-app --branch version-15 erpnext
    • Optionally, add the HR module:
    bench get-app hrms
    • Check installation status:
    bench version --format table
    • Install ERPNext and HR modules to your site:
    bench --site mysite.local install-app erpnext
    bench --site mysite.local install-app hrms
    • Enable the scheduler:
    bench --site mysite.local enable-scheduler
    bench --site mysite.local set-maintenance-mode off

    8. Set Up NGINX and Security

    • Configure NGINX:
    bench setup nginx
    sudo supervisorctl restart all

    If you encounter deprecated Ansible playbook entries, update /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/mariadb/tasks/main.yml by replacing – include with – include_tasks.

    • Set up production configuration:
    sudo bench setup production yourusername
    • Configure the firewall:
    sudo ufw allow 22,25,143,80,443,3306,3022,8000/tcp
    sudo ufw enable

    Access your ERPNext instance at http://your-server-ip:80 using the admin credentials you set.

    9. Add a Domain and SSL Certificate

    • DNS Setup: Add an A record for your domain pointing to your server’s IP.
    • Enable Multitenancy:
    bench config dns_multitenant on
    • Add Domain:
    bench setup add-domain yourdomain.com --site yoursitename
    • Reconfigure NGINX:
    bench setup nginx
    sudo service nginx reload
    • Install SSL with Certbot:
    sudo apt update && sudo apt install snapd -y
    sudo snap install core
    sudo snap refresh core
    sudo snap install --classic certbot
    sudo ln -s /snap/bin/certbot /usr/bin/certbot
    sudo certbot --nginx

    Follow the prompts to secure your domain.

    Conclusion
    By following these instructions, you will have a fully operational ERPNext instance running on your Ubuntu server, ready to streamline your business operations. Take time to explore ERPNext’s features and customize them to fit your organization’s needs.

  • Step-by-Step Guide to Setting Up Your Own Mastodon Server

    What is Mastodon?

    Mastodon is a decentralized social network comprised of separate servers focused on specific themes, topics, or interests. Users can join these servers, follow others, engage in conversations, and perform activities similar to what you’d typically do on platforms like Twitter.

    Mastodon has been in existence since March 2016, but it gained significant popularity in late 2022, thanks to a notable acquisition of a particular social media platform.

    A Mastodon website can function independently, much like a regular website. Users sign up, post messages, share pictures, and have conversations, similar to what you’d expect on any website. However, unlike traditional websites, Mastodon websites can connect and interact with each other. This means that users from different Mastodon websites can communicate, much like how you can send an email from your Gmail account to someone using Outlook, Fastmail, Protonmail, or any other email service, as long as you have their email address. In the same way, you can mention or send messages to anyone on any Mastodon website if you know their username or address.

    Mastodon vs. Twitter: Exploring the Differences in Social Media Platforms

    In the world of social media, Mastodon stands out because it’s all about people having control and being part of a community. It’s not like Twitter, which is really popular but has some problems like keeping your data private and not being clear about how its rules work.

    Mastodon is different. It’s like a friendly neighborhood where everyone helps make the rules. On Twitter, special computer rules decide which posts you see first, which can make you only see similar things and never have a real conversation. But on Mastodon, you see posts in the order they were made, which makes it open and friendly.

    What’s more, on Mastodon, you can even make your own neighborhood and have your own rules. You and your neighbors decide what’s okay and what’s not. This makes Mastodon a unique and user-friendly social place.

    The Benefits of Hosting Your Own Instance

    When it comes to Mastodon, you have choices: join an existing group or start your own. Let’s break it down. Joining an existing group is like moving into a ready-made neighborhood; you’re part of a community right away. But you can’t customize much. On the other hand, having your own group has lots of benefits. You’re the boss; you can make it look and work as you like. You decide the rules, creating a cozy place for you and your friends. Your data is yours, so privacy is no problem.

    Creating Your Own Mastodon Server 

    Before you start your own Mastodon community, remember a few things. You’ll need a server or instance. Also, you must have a proper domain. You can get a domain from any domain provider, and they offer different servers, too. The server you choose depends on how many people will use your Mastodon and how active it is. If you want more options, they have different server configurations too.

    Pre-requisites

    • A computer running Ubuntu 20.04 or Debian 11, where you have full administrative access (root access).
    • Choose a domain name (or subdomain) for your Mastodon server, for example, example.com.
    • An email delivery service or another SMTP server.

    Creating a mastodon System User and granting it administrative privileges

    To begin, go to the root and create your Mastodon user using the ‘adduser’ command.

    sudo su -
    adduser mastodon

    Following that, add your Mastodon user to the sudo group to provide it with administrative privileges:

    usermod -aG sudo mastodon

    Setting Up Mastodon: Installing Dependencies and Cloning the Repository

    Before proceeding, ensure that you have installed curl, wget, GnuPG, apt-transport-https, lsb-release, and ca-certificates.

    apt install -y curl wget gnupg apt-transport-https lsb-release ca-certificates
    

    Node.js

    curl -sL https://deb.nodesource.com/setup_16.x | bash -

    install Node.js 16.x and npm

    apt-get install -y nodejs

    You might also require development tools for creating native add-ons.

    apt-get install gcc g++ make

    To install the Yarn package manager, run:

    curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
    echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    apt-get update
    apt-get install yarn
    wget -O /usr/share/keyrings/postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc
    echo "deb [signed-by=/usr/share/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/postgresql.list

    Install System packages

    apt update
    apt install -y \
      imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev file git-core \
      g++ libprotobuf-dev protobuf-compiler pkg-config nodejs gcc autoconf \
      bison build-essential libssl-dev libyaml-dev libreadline6-dev \
      zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev \
      nginx redis-server redis-tools postgresql postgresql-contrib \
      certbot python3-certbot-nginx libidn11-dev libicu-dev libjemalloc-dev

    To use yarn, activate Node.js’s corepack, which is included by default.

    corepack enable

    Yarn has two distinct development paths, one being version 1.0 (known as classic), and the other being version 2.0. Mastodon specifically needs the classic version of yarn. You can enable this classic version using the command: “yarn set version”.

    yarn set version classic

    Installing Ruby

    To make managing Ruby versions simpler and more efficient, we’ll use rbenv. With rbenv, it’s easier to obtain the correct Ruby versions and update them when new releases become available. However, it’s important to note that rbenv must be installed for a specific Linux user. Therefore, the first step is to create the user that Mastodon will run as.

    switch to mastodon user

    su - mastodon
    git clone https://github.com/rbenv/rbenv.git ~/.rbenv
    cd ~/.rbenv
    src/configure 
    make -C src
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    exec bash
    git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
    RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.2

    To set this Ruby version as the new default.

    rbenv global 3.2.2
    gem install bundler --no-document

    If you find the new version of Gem use this command to install

    gem update --system 3.4.20

    Setting up PostgreSQL

    You should create a PostgreSQL user for Mastodon. In a basic setup, the simplest approach is to use “ident” authentication. This means that the PostgreSQL user doesn’t have a separate password and can be accessed by the Linux user with the same username.

    sudo -u postgres createuser --interactive
    Output
    Enter name of role to add: mastodon
    Shall the new role be a superuser? (y/n) y

    Setting up Mastodon

    To obtain the latest stable release of Mastodon, use Git to download the code.

    cd /home/mastodon/ 
    git clone https://github.com/mastodon/mastodon.git live
    cd live
    git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)

    Installing the last dependencies

    bundle config deployment 'true'
    bundle config without 'development test'
    bundle install -j$(getconf _NPROCESSORS_ONLN)
    yarn install --pure-lockfile

    The two “bundle config” commands are necessary only during the initial dependency installation. If you plan to update or reinstall dependencies at a later time, you can simply use “bundle install.”

    Run the interactive setup of Mastodon

    RAILS_ENV=production bundle exec rake mastodon:setup

    Please enter your domain name. make sure your input is accurate because changing it later can be challenging.

    Mastodon offers a single-user mode where registrations are disabled. If your goal is to create a shared space with others, it’s important not to enable the single-user mode.

    Your instance is identified by its domain name. Changing it afterward will break things.
    Domain name: example.com
    
    Do you want to enable single user mode? (y/N) N
    
    Are you using Docker to run Mastodon? (Y/n) N

    During the PostgreSQL setup, you can keep all the settings as their defaults by simply pressing Enter for each prompt. Your database doesn’t rely on a password for authentication; instead, it uses peer authentication, which we’ll explain further later on. For now, you can leave these settings empty.

    PostgreSQL host:(/var/run/postgresql) /var/run/postgresql
    PostgreSQL port: (5432) 5432
    Name of PostgreSQL database: (mastodon_production) mastodon_production
    Name of PostgreSQL user: (mastodon) mastodon
    Password of PostgreSQL user: 
    Database configuration works!

    Since this database is meant to be accessible only locally on this server, there’s no need to set up a password so, you can keep the Redis settings at their default values, and you can leave the password field empty. Just press Enter for each prompt.

    Redis host:(localhost) localhost
    Redis port:(6379) 6379
    Redis password: 
    Redis configuration works!

    In the next step, you have two options: use local storage or set up cloud storage with various providers. you’ll be prompted to decide how you want to handle file storage for Mastodon. If you prefer local storage please select “No.” if you want to store on cloud storage an immediate cloud storage solution is ready.

    Do you want to store uploaded files on the cloud? (y/N) N

    Mastodon needs access to an SMTP email server to send emails. Maintaining a secure and reliable email server is challenging, so an external provider is recommended. It’s best to use an external email service provider. Note that most charges are based on usage, and some offer a free tier up to a certain limit. Use your discretion in this situation.

    When using email providers, you’ll need to create and configure an account. After signing up, you typically have to verify your domain by adding DNS records. You’ll also require an API key for secure authentication. The exact process varies by provider.

    Do you want to send e-mails from localhost? No
    SMTP server: (smtp.mailgun.org) smtp.mailgun.org
    SMTP port: (587) 587
    SMTP username:
    SMTP password: 
    SMTP authentication: (plain) 
    
    SMTP OpenSSL verify mode: none
    
    Enable STARTTLS: auto
      
    E-mail address to send e-mails "from":mastodon<[email protected]>
    
    Send a test e-mail with this configuration ? (Y/n)Y
    
    Do you want Mastodon to periodically check for important updates and notify you? (Recommended) (Y/n) Y
    
    This configuration will be written to .env.production
    Save configuration? (Y/n) Y
    
    Now that configuration is saved, the database schema must be loaded.
    If the database already exists, this will erase its contents.
    Prepare the database now? Yes
    Running `RAILS_ENV=production rails db:setup` ...
    
    
    Created database 'mastodon_production'
    Done!
    
    The final step is compiling CSS/JS assets.
    This may take a while and consume a lot of RAM.
    Compile the assets now? Yes
    

    Your Mastodon server is ready, but it’s not running yet. You’ll be prompted to create an administrator account for logging into your Mastodon server.

    Do you want to create an admin user straight away? (Y/n) Y
    Username: (admin) 
    E-mail: 

    To check the contents of your generated Mastodon configuration file, open it using the “nano” text editor or your preferred text editor.

    vim ~/live/.env.production

    Setting Up Nginx for Mastodon with Certbot

    Setting up Certbot

     sudo certbot certonly --nginx -d <your_domain>

    Setting up Nginx

    sudo cp /home/mastodon/live/dist/nginx.conf /etc/nginx/sites-available/mastodon
    sudo ln -s /etc/nginx/sites-available/mastodon /etc/nginx/sites-enabled/mastodon

    Open the file located at /etc/nginx/sites-available/mastodon in a text editor.

    sudo vim /etc/nginx/sites-enabled/mastodon 

    Inside this file, replace all instances of “example.com” with your own domain name. Make any other necessary adjustments according to your configuration needs. Look for lines beginning with “ssl_certificate” and “ssl_certificate_key.” Remove the “#” symbol at the beginning of these lines to uncomment them. Then, replace the path in these lines with the correct file paths for your SSL certificate and key, which should correspond to your domain name. Save the file, after making the changes.

    sudo systemctl reload nginx

    Setting up systemd services

    Please copy the systemd service templates from the Mastodon directory and paste in the systemd/system directory

    sudo cp /home/mastodon/live/dist/mastodon-*.service /etc/systemd/system/

    If you made any changes from the default settings, please double-check that the username and file paths are accurate.

    sudo vim /etc/systemd/system/mastodon-*.service

    Lastly, begin and activate the new systemd services.

    sudo systemctl daemon-reload
    sudo systemctl enable --now mastodon-web mastodon-sidekiq mastodon-streaming
    sudo systemctl start mastodon-sidekiq mastodon-web

    These services will now start automatically during boot.

    To access your mastodon toy need to copy your domain and search on the browser it will open your mastodon account click on login and login with the credentials you get while setting up mastodon.