Skip to content

Latest commit

 

History

History
168 lines (114 loc) · 4.37 KB

ubuntu.md

File metadata and controls

168 lines (114 loc) · 4.37 KB

Ubuntu

Prerequisites

  • RAM:4GB
  • HD : 30GB

Installing

  • Bootable OS

check your current Ubuntu version

    cat /etc/*release  

Fix Broken Package

    sudo apt --fix-broken install

Change swap size in Ubuntu 18.04 or newer

    sudo swapoff -a 
    sudo dd if=/dev/zero of=/swapfile bs=1G count=8 
    sudo chmod 600 /swapfile 
    sudo mkswap /swapfile 
    sudo swapon /swapfile

    Edit /etc/fstab and add the new swapfile if it isn’t already there

    /swapfile none swap sw 0 0

    Check the amount of swap available:

    sudo swapon --show
    sudo free -h
    grep SwapTotal /proc/meminfo



    sudo swapon --show
    sudo swapoff -a 
    sudo dd if=/dev/zero of=/swapfile bs=1G count=16
    sudo fallocate -l 3G /swapfile
    sudo dd if=/dev/zero of=/swapfile bs=3082 count=3048576
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    sudo nano /etc/fstab
    sudo swapon --show
    sudo free -h
    cat /proc/sys/vm/swappiness
    sudo sysctl vm.swappiness=10
    free -m

    sudo service elasticsearch start
    curl -X GET 'http://localhost:9200'
    free -m

s

In the following example, we’ll extend the swap space available in the /swapfile from 4 GB to 8 GB.

Turn off all swap processes

    sudo swapoff -a
  1. Resize the swap

     sudo dd if=/dev/zero of=/swapfile bs=1G count=8
    

if = input file of = output file bs = block size count = multiplier of blocks

  1. Change permission

     sudo chmod 600 /swapfile
    
  2. Make the file usable as swap

       sudo mkswap /swapfile
    
  3. Activate the swap file

1 sudo swapon /swapfile 6. Edit /etc/fstab and add the new swapfile if it isn’t already there

    /swapfile none swap sw 0 0
  1. Check the amount of swap available

     grep SwapTotal /proc/meminfo
    

Updating Ubuntu Kernel

    cat /etc/apt/sources.list
    uname -r
    uname -mrs 
    #Linux 4.4.0-64 generic
    sudo add-apt-repository ppa:cappelikan/ppa -y
    sudo apt install mainline -y
    
    sudo apt update && sudo apt upgrade -y
    sudo apt-get dist-upgrade -y
    update-manager –d
    sudo reboot

CLI Short/ alias:

    nano  ~/.bashrc
    source ~/.bashrc
    alias html="cd /var/www/html"
    alias shopify="cd /var/www/html/shopify"
    alias cl="clear"          
    alias u2="sudo apt update -y"
    alias u3="sudo apt update && sudo apt upgrade -y"
    alias uf="sudo apt --fix-broken install -y"
    alias ur="sudo apt autoremove -y"
    alias upg="apt list --upgradable -y"
    alias hs="history"
    alias cu="composer update"
    alias cui="composer update --ignore-platform-reqs"
    #Git
    alias gb="git branch"
    
    #PHP
    alias pv=" php -v"
    alias pvs="sudo update-alternatives --config php"
    alias p81="sudo systemctl daemon-reload && sudo service php8.1-fpm restart"
    alias p82="sudo systemctl daemon-reload && sudo service php8.2-fpm restart"
    alias p83="sudo systemctl daemon-reload && sudo service php8.3-fpm restart"
    alias p84="sudo systemctl daemon-reload && sudo service php8.3-fpm restart"

    #nginx
    alias nr="sudo service nginx restart"
    alias nt="sudo nginx -t"
    
    #magento
    alias mrm="rm -rf var/cache/* var/tmp/_cache var/composer_home/cache/* var/view_preprocessed/* var/page_cache/* var/report/* var/log/* generated/code/*  pub/static/* "
    alias msu="php bin/magento s:up && bin/magento s:d:c && bin/magento s:s:d -f &&  bin/magento c:f && bin/magento i:rei"
    alias mdc="php bin/magento s:d:c && bin/magento s:s:d -f &&  bin/magento c:f && bin/magento i:rei"
    alias mcd="php bin/magento s:s:d -f &&  bin/magento c:f && bin/magento i:rei"
    alias mcf="php bin/magento c:c && php bin/magento c:f"
    alias mc="php bin/magento c:c"
    alias mf="php php bin/magento c:f"

Search

    grep -R "what" "where"
    grep -R "78048 Villingen-Schwenningen" .
    grep -R "minicart.js" .
    grep -R "apple-black-logo-bFu.svg" .
    grep -R "catalog_product_index_eav_temp.PRIMARY" .

Ubuntu 23.04

Ref