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 04:50] 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:
  
-Install vim 
 <code> <code>
-apt -y install vim+vi ~/.inputrc 
 +set enable-bracketed-paste off
 </code> </code>
  
-Temporarily allow root access for setup+Update system and install prereq
 <code> <code>
-sudo sed --E '/^\s*#?\s*PermitRootLogin\s+.*/c\PermitRootLogin yes' /etc/ssh/sshd_config && grep -q '^\s*PermitRootLogin yes' /etc/ssh/sshd_config || echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config +apt update && sudo apt upgrade -
-systemctl restart ssh+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>
-Change root password+ 
 +<code> 
 +apt install -y openvswitch-switch 
 +</code> 
 + 
 +Temporarily allow SSH root access for setup 
 +<code> 
 +sed -i -E '/^\s*#?\s*PermitRootLogin\s+.*/d' /etc/ssh/sshd_config && echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config 
 +systemctl restart sshd 
 +</code> 
 + 
 +Add authorized_keys  
 +<code> 
 +grep -qxF 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiKJ/84kE14mqkZllnBFHfsXD10UmEuE6phOvdBC8k/CbybfPEEYUbPW87hykxK8iE0vx8abD58DEOHh0KHpVK3uFB+NqufA5BXixUChZfBoNtK7kJIaJvo4OWOrU09uQ4KYTDXDX61H76MnDSGwPluRw2qSSRPyDS3jMpPpg0iwS1VWmkdvCqn+cqCkZrMGLvK+AKrB8QsaDT33qpmSteaWUM7ZbScVhpWv7o7Zmek0j1jJ8wpSULZpAUW+er0CVS2reaCSTpbX6wYfXs0Vkknt' /root/.ssh/authorized_keys || echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiKJ/84kE14mqkZllnBFHfsXD10UmEuE6phOvdBC8k/CbybfPEEYUbPW87hykxK8iE0vx8abD58DEOHh0KHpVK3uFB+NqufA5BXixUChZfBoNtK7kJIaJvo4OWOrU09uQ4KYTDXDX61H76MnDSGwPluRw2qSSRPyDS3jMpPpg0iwS1VWmkdvCqn+cqCkZrMGLvK+AKrB8QsaDT33qpmSteaWUM7ZbScVhpWv7o7Zmek0j1jJ8wpSULZpAUW+er0CVS2reaCSTpbX6wYfXs0Vkknt' | tee -a /root/.ssh/authorized_keys 
 +</code> 
 + 
 +Set explicit root password
 <code> <code>
-sudo passwd root+passwd root
 </code> </code>
  
-Fix bash history in .bashrc (also repeat this for root) Remember go to the local home directory first+Infinite bash history in .bashrc
 <code> <code>
 +cd /root
 sed -i -E '/^\s*HISTSIZE=.*$/c\HISTSIZE=-1' .bashrc && sed -i -E '/^\s*HISTFILESIZE=.*$/c\HISTFILESIZE=-1\nPROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"' .bashrc sed -i -E '/^\s*HISTSIZE=.*$/c\HISTSIZE=-1' .bashrc && sed -i -E '/^\s*HISTFILESIZE=.*$/c\HISTFILESIZE=-1\nPROMPT_COMMAND="history -a; history -n; $PROMPT_COMMAND"' .bashrc
 source .bashrc source .bashrc
 </code> </code>
  
 +If you didn't config the machine as static but you want to
 +<code>
 +# detect current interface, IP/CIDR and gateway
 +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
 +network:
 +  version: 2
 +  renderer: networkd
 +  ethernets:
 +    $iface:
 +      dhcp4: false
 +      addresses:
 +        - $cidr
 +      routes:
 +        - to: 0.0.0.0/0
 +          via: $gw
 +      nameservers:
 +        addresses:
 +          - 8.8.8.8
 +          - 8.8.4.4
 +EOF
 +
 +# 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> <code>
-vi /etc/ssh/sshd_config +sudo systemctl disable --now systemd-resolved 
-systemctl restart ssh+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>
  
 +If by chance auditd is running, disable it (auditd is off on a bare installation)
 <code> <code>
 vi  /etc/audit/auditd.conf vi  /etc/audit/auditd.conf
Line 36: 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> 
 + 
 +Fix nvme bug and turn off audit and app armor 
 +<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 
 +update-grub
 </code> </code>
  
 <code> <code>
-cd /etc/netplan/ 
-vi 01-network-manager-all.yaml 
-netplan try 
  
-vi /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg 
-mv 01-network-manager-all.yaml 01-netcfg.yaml 
-netplan try 
-vi 01-netcfg.yaml 
-netplan try 
 </code> </code>
  
-   47  cd /etc/ +<code> 
-   48  less issue +Install ipmitool 
-   49  less issue.net+@reboot /usr/bin/python3 /root/hostinfoLCDbyid.py 
 +</code>
  
-   50  cd update-motd.d/ +AI
-   52  less 50-motd-news +
-   54  chmod a-x *+
  
-   57  vi 50-landscape-sysinfo+Cuda 12.x uses ≥525 
 +<code> 
 +add-apt-repository ppa:graphics-drivers/ppa -y 
 +apt update 
 +</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 -
 +</code>
  
-  185  apt get apache +<code> 
-  186  apt install apache2 +reboot 
-  189  systemctl start apache2 +</code>
-  192  cd /var/www/html/ +
-  197  vi index.html+
  
-  207  apt install mariadb-server +Verify Installation 
-  208  systemctl start mariadb.service +<code> 
-  209  mysql_secure_installation +nvidia-smi 
-  212  mysql -uroot -p+</code>
  
-  217  apt install libapache2-mod-php php-mysql +Add CUDA repo 
-  218  cd /etc/apache2/mods-enabled+<code> 
-  221  vi dir.conf +# Ensure NVIDIA CUDA repo is added: 
-  222  systemctl restart apache2 +sudo apt install software-properties-common 
-  223  systemctl status apache2 +distribution="ubuntu2204" 
-  224  apt search php| less +wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.1-1_all.deb 
-  225  ls +sudo dpkg -i cuda-keyring_1.1-1_all.deb 
-  226  cd +sudo apt update 
-  227  cd /var/www/html/ + 
-  228  ls -al +# List the latest CUDA toolkit packages available: 
-  229  vi cam.html +apt-cache madison cuda-toolkit 
-  230  vi save_photo.php +</code> 
-  231  mkdir uploads + 
-  232  ps -ef +Returns 
-  233  chown www-data uploads/ +<code> 
-  234  ls -al +cuda-toolkit |   12.9.0-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  235  ls +cuda-toolkit |   12.8.1-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  236  cd /var/www/ +cuda-toolkit |   12.8.0-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  237  ls +cuda-toolkit |   12.6.3-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  238  cd html+cuda-toolkit |   12.6.2-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  239  ls +cuda-toolkit |   12.6.1-1 | https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  Packages 
-  240  vi cam.html +</code> 
-  241  ls + 
-  242  \rm cam.html +Install the latest toolkit 
-  243  vi p.php +<code> 
-  244  vi c2.html +sudo apt install cuda-toolkit-12-9 -y 
-  245  ls a-l +</code> 
-  246  ls + 
-  247  ls -al uploads+Set CUDA environment variables 
-  248  pwd +<code> 
-  249  service apache2 restart +echo 'export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}' >> ~/.bashrc 
-  250  ls +echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc 
-  251  vi p.php +source ~/.bashrc 
-  252  ls +</code> 
-  253  vi index.html + 
-  254  cd +Verify CUDA 
-  255  ls +<code> 
-  256  penssl genrsa -aes128 -out private.key 2048 +nvcc --version 
-  257  openssl genrsa -aes128 -out private.key 2048 +</code> 
-  258  openssl req  -nodes -new -x509  -keyout server.key -out server.cert + 
-  259  ls + 
-  260  mkdir keys +<code> 
-  261  mv server.* keys +apt install nfs-common 
-  262  cd keys/ + 
-  263  ls +apt install nfs-kernel-server 
-  264  openssl req -new -days 999 -key private.key -out request.csr +</code> 
-  265  ls + 
-  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 + 
-  268  ls -l + 
-  269  cd /etc/apache2/ + 
-  270  ls + 
-  271  cd conf-available/ +<code> 
-  272  ls +apt install apache2 
-  273  vi ssl-params.conf +systemctl start apache2 
-  274  cd ../sites-available/ + 
-  275  ls +apt install mariadb-server 
-  276  ls +systemctl start mariadb.service 
-  277  mv certificate.crt server.crt +mysql_secure_installation 
-  278  ls +mysql -uroot -p 
-  279  openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem + 
-  280  ls +apt install libapache2-mod-php php-mysql 
-  281  openssl rsa -in server.key -text > private.pem +cd /etc/apache2/mods-enabled/ 
-  282  openssl x509 -inform PEM -in server.crt > public.pem +vi dir.conf 
-  283  ls +systemctl restart apache2 
-  284  mkdir /etc/ssl/hot +systemctl status apache2 
-  285  mv server.* /etc/ssl/hot/ +openssl genrsa -aes128 -out private.key 2048 
-  286  ls +openssl req  -nodes -new -x509  -keyout server.key -out server.cert 
-  287  mv * /etc/ssl/hot/ +openssl req -new -days 999 -key private.key -out request.csr 
-  288  ls -l /etc/ssl/hot/ +openssl req -new -days 999 -key server.key -out server.csr 
-  289  pwd +openssl x509 -in server.csr -out certificate.crt -req -signkey server.key -days 999 
-  290  vi /var/www/html/p.php +cd /etc/apache2/conf-available/ 
-  291  ls +vi ssl-params.conf 
-  292  ls -al +cd ../sites-available/ 
-  293  cd +openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem 
-  294  cd /var/www/html/ +openssl rsa -in server.key -text > private.pem 
-  295  ls +openssl x509 -inform PEM -in server.crt > public.pem 
-  296  service apache2 restart +vi default-ssl.conf 
-  297  ls +a2enmod ssl 
-  298  ls -l +a2enconf ssl-params 
-  299  vi default-ssl.conf +a2ensite default-ssl 
-  300  a2enmod ssl +vi /etc/apache2/conf-enabled/ssl-params.conf 
-  301  a2enconf ssl-params +apache2ctl configtest 
-  302  a2ensite default-ssl +systemctl restart apache2 
-  303  apache2ctl configtest +vi /etc/php/7.4/apache2/php.ini 
-  304  vi /etc/apache2/conf-enabled/ssl-params.conf +apt install nmap 
-  305  apache2ctl configtest +</code> 
-  306  vi /etc/apache2/conf-enabled/ssl-params.conf + 
-  307  apache2ctl configtest +===== WiFi + “jerky typing” fix for low power wifi cards!!!! ===== 
-  308  systemctl restart apache2 + 
-  309  ls +Run <code>ip addr</code> to find the wlan card, mine is wlp2s0. 
-  310  cd /var/www/ + 
-  311  ls +Test if this is the problem first. 
-  312  cd html/ +<code> 
-  313  ls +iw dev wlan0 get power_save 
-  314  ls +</code> 
-  315  vi c2.html +if its on, it will report: 
-  316  vi /var/log/apache2/error.log +<code> 
-  317  find / > /tmp/fl.txt +Power save: on 
-  318  vi /etc/php/7.4/apache2/php.ini +</code> 
-  319  ls +Turn off power save via: 
-  320  ls /tmp+<code> 
-  321  ls -al +sudo iw dev wlan0 set power_save off 
-  322  ls uploads/ +</code> 
-  323  cd /var/log+If that works, make it permanent via (also note this isn't the "rightway, just the fastest way) 
-  324  ls +<code> 
-  325  vi /etc/php/7.4/apache2/php.ini +vi /etc/systemd/system/wifi-powersave-off.service 
-  326  echo -ne '\e]4;4;#0000FF\a' +</code> 
-  327  ls +Add the following snippet 
-  328  echo -ne '\e]4;4;#8888FF\a' +<code> 
-  329  ls +[Unit] 
-  330  vi /etc/php/7.4/apache2/php.ini +Description=Disable WiFi Power Save 
-  331  echo -e "\e]P46495ED+After=network.target 
-  332  ls + 
-  333  vi /etc/php/7.4/apache2/php.ini +[Service] 
-  334  ls -al +Type=oneshot 
-  335  vi /etc/bash.bashrc +ExecStart=/usr/sbin/iw dev wlp2s0 set power_save off 
-  336  ls -al + 
-  337  grep php.log /tmp/fl.txt +[Install] 
-  338  vi /etc/php/7.4/apache2/php.ini +WantedBy=multi-user.target 
-  339  ls a-l +</code> 
-  340  ls -al +Make it permanent 
-  341  touch php.loh +<code> 
-  342  touch php.log +sudo systemctl daemon-reexec 
-  343  ls -al +sudo systemctl enable wifi-powersave-off 
-  344  rm php.loh +sudo systemctl start wifi-powersave-off 
-  345  chmod a+x php.log +</code>
-  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.1747975809.txt.gz · Last modified: 2025/05/23 04:50 by kenson

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki