workstation ⚙️ Ubuntu Linux OS - martindubenet/wed-dev-design GitHub Wiki

💡 Ubuntu/Linux tips & tricks

Terminal frequent commands

  • Check your Ubuntu version

    lsb_release -a

  • Change Directory to
    • User root

      cd ~/

    • Downloads

      cd ~/Downloads

    • Projects

      cd ~/Projects/1idweb/martindube.net/doc/cv

For more command lines: code • Terminal command lines (CLI)

 

Ubuntu package managements

In command lines starting with sudo apt, apt is the package manager for Ubunto OS while curl allowes allows you to download data from the web.

Required development dependencies:

  1. curl via apt : sudo apt install curl -y
  2. NVM via curl : curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  3. NodeJS and npm via NVM : nvm install --lts

    Make --lts your default node version:

    • nvm use --lts
    • nvm alias default lts

Local hosted development

We have two common server; Either the classic Apache or Nginx. The later is more performant allowing to handle many concurrent connections.

 

Apache server

Start End
Terminal systemctl status apache2 Ctrl+C
  1. Open Terminal

    Ctrl+Alt+T

  2. Update Package List

    sudo apt update

  3. Install Apache

    sudo apt install apache2

  4. Adjust Firewall (if UFW is active)
    • Check the status of UFW

      sudo ufw status

    • If it is active you'll need to allow HTTP traffic. Copy/Paste this command line in Terminal

      sudo ufw allow 'Apache'

  5. Verify Apache Status

    sudo systemctl status apache2

  6. Test Your Local Server in your browser

    http://localhost or http://127.0.0.1

  7. You should see the Apache Ubuntu Default Page, which confirms that your local server is running.

Set your local root directory

The default web root directory for Apache on Ubuntu is /var/www/html. This is where you'll place your website files.

  • Change Directory to your local root

    cd /var/www/html

Permissions

When working in /var/www/html, you may encounter permission issues. It's common to change the ownership of this directory to your user to avoid using sudo for every file operation. For example, to change ownership to your user (replace your_username with your actual username in the following command line):

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

Nginx web server

Nginx (pronounced "engine-x") is a high-performance web server that's often preferred for its efficiency and ability to handle many concurrent connections.

 

Install PHP

sudo apt install php libapache2-mod-php php-cli php-mysql php-mbstring php-xml php-gd php-curl

Typical PHP extensions for development included in the above command line:

  • php : The core PHP interpreter. libapache2-mod-php: The Apache module for PHP.
  • php-cli : PHP Command Line Interface, useful for running PHP scripts from the terminal.
  • php-mysql : Enables PHP to connect to MySQL/MariaDB databases (essential for many web applications).
  • php-mbstring : Provides multi-byte string functions (often required by frameworks).
  • php-xml : Enables XML parsing capabilities.
  • php-gd : For image manipulation (e.g., generating thumbnails).
  • php-curl : For making HTTP requests from PHP.

Enable PHP Module (if not enabled automatically)

The libapache2-mod-php package usually enables the PHP module automatically. However, if for some reason it's not, you can manually enable it and the dir module (which helps Apache serve index.php files correctly) :

  1. sudo a2enmod php
  2. sudo a2enmod dir

 

MyPage for Github

Local setup using ViteJS

  1. yarn create vite MyPage --template vue
  2. cd MyPage
  3. yarn
  4. Run local server: yarn dev

Clear your node_modules/ dependencies

  1. rm -rf node_modules yarn.lock
  2. yarn cache clean
  3. yarn install

 

 

⚠️ **GitHub.com Fallback** ⚠️