Meh Belly Lint Collection

That awful moment when you realize,
THIS is YOUR circus and THOSE are YOUR monkeys.

User Tools

Site Tools


ubuntu_steps

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ubuntu_steps [2025/05/23 05:31] kensonubuntu_steps [2026/04/23 07:14] (current) kenson
Line 1: Line 1:
-Start with "bare" ubuntu+Start with "bare" ubuntu, I'm still on 22.04 LTS 
 + 
 +Notes:
  
-Just be root 
 <code> <code>
-sudo su -+vi ~/.inputrc 
 +set enable-bracketed-paste off
 </code> </code>
  
 +Update system and install prereq
 <code> <code>
-apt update+apt update && sudo apt upgrade -y 
 +apt -y install build-essential dkms linux-headers-$(uname -r) software-properties-common curl wget git  
 +apt -y install iputils-ping traceroute  
 +apt -y install vim  
 +apt -y install build-essential 
 +apt -y install net-tools 
 +apt -y install less 
 +apt -y install libssl-dev 
 +apt -y install libz-dev 
 +apt -y install python3-pip 
 +apt -y install python3-venv 
 +apt -y install cron 
 +apt -y install ipmitool
 </code> </code>
  
-Install vim 
 <code> <code>
-apt -y install vim+apt install -y openvswitch-switch
 </code> </code>
  
Line 31: Line 45:
 </code> </code>
  
-Fix bash history in .bashrc+Infinite bash history in .bashrc
 <code> <code>
 cd /root cd /root
Line 40: Line 54:
 If you didn't config the machine as static but you want to If you didn't config the machine as static but you want to
 <code> <code>
-sudo mkdir -p /etc/cloud/cloud.cfg.d && +# detect current interface, IP/CIDR and gateway 
-echo 'network: {config: disabled}' | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg && \+iface=$(ip route show default | awk '/default/ {for(i=1;i<=NF;i++) if($i=="dev"){print $(i+1); exit}}'
 +cidr=$(ip -o -4 addr show dev "$iface" | awk '{print $4}'
 +gw=$(ip route show default | awk '/default/ {print $3}'
 + 
 +# disable cloud-init network config 
 +sudo mkdir -p /etc/cloud/cloud.cfg.d \ 
 +  && echo 'network: {config: disabled}' 
 +      | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg >/dev/null 
 + 
 +# write your custom netplan
 sudo tee /etc/netplan/01-netcfg.yaml >/dev/null <<EOF sudo tee /etc/netplan/01-netcfg.yaml >/dev/null <<EOF
 network: network:
 +  version: 2
 +  renderer: networkd
   ethernets:   ethernets:
-    ens3f0:+    $iface:
       dhcp4: false       dhcp4: false
       addresses:       addresses:
-        - 10.10.22.181/24 +        - $cidr 
-      gateway410.10.22.1+      routes: 
 +        - to: 0.0.0.0/0 
 +          via: $gw
       nameservers:       nameservers:
         addresses:         addresses:
           - 8.8.8.8           - 8.8.8.8
           - 8.8.4.4           - 8.8.4.4
-  version: 2 
 EOF EOF
-sudo bash -c "echo 'This file has been disabled by custom configuration (/etc/netplan/01-netcfg.yaml).> /etc/netplan/50-cloud-init.yaml" + 
-echo REMEMBER TO SET IP IN /etc/netplan/01-netcfg.yaml+# disable the auto-generated cloud-init netplan 
 +sudo tee /etc/netplan/50-cloud-init.yaml >/dev/null <<EOF 
 +# disabled by custom config (/etc/netplan/01-netcfg.yaml) 
 +EOF 
 + 
 +echo "✔️  Netplan written for $iface ($cidr) via $gw" 
 + 
 +</code> 
 + 
 +Fix DNS, e.g. 86 systemd-resolvd 
 +<code> 
 +sudo systemctl disable --now systemd-resolved 
 +sudo rm /etc/resolv.conf 
 +echo -e "nameserver 8.8.8.8\nnameserver 8.8.4.4" | sudo tee /etc/resolv.conf >/dev/null
 </code> </code>
  
Line 68: Line 107:
 </code> </code>
  
-Verify UFW is inactive+Verify UFW is inactive if installed, should return "Status: inactive"
 <code> <code>
 ufw status ufw status
-Status: inactive 
 </code> </code>
  
-Fix nvme bug and turn off audit and apparmor+Fix nvme bug and turn off audit and app armor
 <code> <code>
 sudo sed -i '/^\s*GRUB_CMDLINE_LINUX_DEFAULT=/d' /etc/default/grub && echo 'GRUB_CMDLINE_LINUX_DEFAULT="audit=0 pcie_aspm=off pcie_port_pm=off nvme_core.default_ps_max_latency_us=0 apparmor=0 security=apparmor"' | sudo tee -a /etc/default/grub && sudo update-grub sudo sed -i '/^\s*GRUB_CMDLINE_LINUX_DEFAULT=/d' /etc/default/grub && echo 'GRUB_CMDLINE_LINUX_DEFAULT="audit=0 pcie_aspm=off pcie_port_pm=off nvme_core.default_ps_max_latency_us=0 apparmor=0 security=apparmor"' | sudo tee -a /etc/default/grub && sudo update-grub
Line 81: Line 119:
  
 <code> <code>
-apt -y install build-essential +
-apt -y install net-tools +
-apt -y install less +
-apt -y install libssl-dev +
-apt -y install libz-dev +
-apt -y install python3-pip +
-apt -y install python3-venv +
-apt -y install cron +
-apt -y install ipmitool+
 </code> </code>
  
Line 97: Line 127:
 </code> </code>
  
 +AI
 +
 +Cuda 12.x uses ≥525
 <code> <code>
-   47  cd /etc+add-apt-repository ppa:graphics-drivers/ppa -y 
-   48  less issue +apt update 
-   49  less issue.net+</code> 
 +Check for latest recommended NVIDIA driver 
 +<code> 
 +ubuntu-drivers devices 
 +</code> 
 +Replace 575-open with the recommended, for certain 40 series and all 50 series use the open 
 +<code> 
 +apt install nvidia-driver-575-open -y 
 +</code>
  
-   50  cd update-motd.d/ +<code> 
-   52  less 50-motd-news +reboot 
-   54  chmod a-x *+</code>
  
-   57  vi 50-landscape-sysinfo+Verify Installation 
 +<code> 
 +nvidia-smi 
 +</code>
  
-  185  apt get apache +Add CUDA repo 
-  186  apt install apache2 +<code> 
-  189  systemctl start apache2 +# Ensure NVIDIA CUDA repo is added: 
-  192  cd /var/www/html+sudo apt install software-properties-common 
-  197  vi index.html+distribution="ubuntu2204" 
 +wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb 
 +sudo dpkg -i cuda-keyring_1.1-1_all.deb 
 +sudo apt update
  
-  207  apt install mariadb-server +# List the latest CUDA toolkit packages available: 
-  208  systemctl start mariadb.service +apt-cache madison cuda-toolkit 
-  209  mysql_secure_installation +</code>
-  212  mysql -uroot -p+
  
-  217  apt install libapache2-mod-php php-mysql +Returns 
-  218  cd /etc/apache2/mods-enabled/ +<code> 
-  221  vi dir.conf +cuda-toolkit |   12.9.0-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  222  systemctl restart apache2 +cuda-toolkit |   12.8.1-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  223  systemctl status apache2 +cuda-toolkit |   12.8.0-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  224  apt search php- | less +cuda-toolkit |   12.6.3-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  225  ls +cuda-toolkit   12.6.2-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  226  cd +cuda-toolkit |   12.6.1-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  227  cd /var/www/html/ +</code> 
-  228  ls -al + 
-  229  vi cam.html +Install the latest toolkit 
-  230  vi save_photo.php +<code> 
-  231  mkdir uploads +sudo apt install cuda-toolkit-12-9 -y 
-  232  ps -ef +</code> 
-  233  chown www-data uploads+ 
-  234  ls -al +Set CUDA environment variables 
-  235  ls +<code> 
-  236  cd /var/www+echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc 
-  237  ls +echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc 
-  238  cd html+source ~/.bashrc 
-  239  ls +</code> 
-  240  vi cam.html + 
-  241  ls +Verify CUDA 
-  242  \rm cam.html +<code> 
-  243  vi p.php +nvcc --version 
-  244  vi c2.html +</code> 
-  245  ls a-l + 
-  246  ls + 
-  247  ls -al uploads+<code> 
-  248  pwd +apt install nfs-common 
-  249  service apache2 restart + 
-  250  ls +apt install nfs-kernel-server 
-  251  vi p.php +</code> 
-  252  ls + 
-  253  vi index.html + 
-  254  cd + 
-  255  ls + 
-  256  penssl genrsa -aes128 -out private.key 2048 + 
-  257  openssl genrsa -aes128 -out private.key 2048 + 
-  258  openssl req  -nodes -new -x509  -keyout server.key -out server.cert +<code> 
-  259  ls +apt install apache2 
-  260  mkdir keys +systemctl start apache2 
-  261  mv server.* keys + 
-  262  cd keys/ +apt install mariadb-server 
-  263  ls +systemctl start mariadb.service 
-  264  openssl req -new -days 999 -key private.key -out request.csr +mysql_secure_installation 
-  265  ls +mysql -uroot -p 
-  266  openssl req -new -days 999 -key server.key -out server.csr + 
-  267  openssl x509 -in server.csr -out certificate.crt -req -signkey server.key -days 999 +apt install libapache2-mod-php php-mysql 
-  268  ls -l +cd /etc/apache2/mods-enabled/ 
-  269  cd /etc/apache2/ +vi dir.conf 
-  270  ls +systemctl restart apache2 
-  271  cd conf-available/ +systemctl status apache2 
-  272  ls +openssl genrsa -aes128 -out private.key 2048 
-  273  vi ssl-params.conf +openssl req  -nodes -new -x509  -keyout server.key -out server.cert 
-  274  cd ../sites-available/ +openssl req -new -days 999 -key private.key -out request.csr 
-  275  ls +openssl req -new -days 999 -key server.key -out server.csr 
-  276  ls +openssl x509 -in server.csr -out certificate.crt -req -signkey server.key -days 999 
-  277  mv certificate.crt server.crt +cd /etc/apache2/conf-available/ 
-  278  ls +vi ssl-params.conf 
-  279  openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem +cd ../sites-available/ 
-  280  ls +openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem 
-  281  openssl rsa -in server.key -text > private.pem +openssl rsa -in server.key -text > private.pem 
-  282  openssl x509 -inform PEM -in server.crt > public.pem +openssl x509 -inform PEM -in server.crt > public.pem 
-  283  ls +vi default-ssl.conf 
-  284  mkdir /etc/ssl/hot +a2enmod ssl 
-  285  mv server.* /etc/ssl/hot/ +a2enconf ssl-params 
-  286  ls +a2ensite default-ssl 
-  287  mv * /etc/ssl/hot/ +vi /etc/apache2/conf-enabled/ssl-params.conf 
-  288  ls -l /etc/ssl/hot/ +apache2ctl configtest 
-  289  pwd +systemctl restart apache2 
-  290  vi /var/www/html/p.php +vi /etc/php/7.4/apache2/php.ini 
-  291  ls +apt install nmap 
-  292  ls -al +</code> 
-  293  cd + 
-  294  cd /var/www/html/ +===== WiFi + “jerky typing” fix for low power wifi cards!!!! ===== 
-  295  ls + 
-  296  service apache2 restart +Run <code>ip addr</code> to find the wlan card, mine is wlp2s0. 
-  297  ls + 
-  298  ls -l +Test if this is the problem first. 
-  299  vi default-ssl.conf +<code> 
-  300  a2enmod ssl +iw dev wlan0 get power_save 
-  301  a2enconf ssl-params +</code> 
-  302  a2ensite default-ssl +if its on, it will report: 
-  303  apache2ctl configtest +<code> 
-  304  vi /etc/apache2/conf-enabled/ssl-params.conf +Power save: on 
-  305  apache2ctl configtest +</code> 
-  306  vi /etc/apache2/conf-enabled/ssl-params.conf +Turn off power save via: 
-  307  apache2ctl configtest +<code> 
-  308  systemctl restart apache2 +sudo iw dev wlan0 set power_save off 
-  309  ls +</code> 
-  310  cd /var/www/ +If that works, make it permanent via (also note this isn't the "rightway, just the fastest way) 
-  311  ls +<code> 
-  312  cd html/ +vi /etc/systemd/system/wifi-powersave-off.service 
-  313  ls +</code> 
-  314  ls +Add the following snippet 
-  315  vi c2.html +<code> 
-  316  vi /var/log/apache2/error.log +[Unit] 
-  317  find / > /tmp/fl.txt +Description=Disable WiFi Power Save 
-  318  vi /etc/php/7.4/apache2/php.ini +After=network.target 
-  319  ls + 
-  320  ls /tmp+[Service] 
-  321  ls -al +Type=oneshot 
-  322  ls uploads/ +ExecStart=/usr/sbin/iw dev wlp2s0 set power_save off 
-  323  cd /var/log+ 
-  324  ls +[Install] 
-  325  vi /etc/php/7.4/apache2/php.ini +WantedBy=multi-user.target 
-  326  echo -ne '\e]4;4;#0000FF\a' +</code> 
-  327  ls +Make it permanent 
-  328  echo -ne '\e]4;4;#8888FF\a' +<code> 
-  329  ls +sudo systemctl daemon-reexec 
-  330  vi /etc/php/7.4/apache2/php.ini +sudo systemctl enable wifi-powersave-off 
-  331  echo -e "\e]P46495ED+sudo systemctl start wifi-powersave-off 
-  332  ls +</code>
-  333  vi /etc/php/7.4/apache2/php.ini +
-  334  ls -al +
-  335  vi /etc/bash.bashrc +
-  336  ls -al +
-  337  grep php.log /tmp/fl.txt +
-  338  vi /etc/php/7.4/apache2/php.ini +
-  339  ls a-l +
-  340  ls -al +
-  341  touch php.loh +
-  342  touch php.log +
-  343  ls -al +
-  344  rm php.loh +
-  345  chmod a+x php.log +
-  346  ls -al +
-  347  chmod a+w php.log +
-  348  chmod a-x php.log +
-  349  ls -al +
-  350  service apache2 restart +
-  351  ls -al +
-  352  cd /var/www/html/ +
-  412  apt  install nmap+
  
ubuntu_steps.1747978312.txt.gz · Last modified: 2025/05/23 05:31 by kenson

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki