Prep - Install Nvidia driver and cuda-toolkit I installed on Ubuntu 20.04.
Install https://developer.nvidia.com/ffmpeg
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git cd nv-codec-headers && sudo make install && cd – git clone https://git.ffmpeg.org/ffmpeg.git cd ffmpeg #export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" sudo apt install -y pkg-config ./configure --enable-cuda-sdk --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 make -j 10 Error 1 /usr/local/cuda-10.2/bin/../targets/x86_64-linux/include/crt/host_config.h:138:2: error: #error -- unsupported GNU version! gcc versions later than 8 are not supported! 138 | #error -- unsupported GNU version!
After OS install - basical update Upgrade softwares sudo su apt update apt upgrade -y ssh hardening ssh user@newserver.com mkdir .ssh chmod 700 .ssh #copy id_ecdsa.pub in .ssh/authorized_keys chmod 600 .ssh/authorized_keys In /etc/ssh/sshd_config add the following configurations.
PermitRootLogin no PubkeyAuthentication yes PasswordAuthentication no After configuration, restart sshd.
sudo systemctl restart sshd sudo su passwd # Change root passwd Firewall - ufw https://ubuntu.com/engage/20.04-webinars
This comes through the constant security patching process and new features like the Ubuntu Server Live installer, iptables to nftables migration, and more resilient boot loader.
Install in Ubuntu apt install -y memcached Configuration The configuration file is /etc/memcached.conf. There are comment of each options in the default config file.
-d -m 256 -p 11211 -u memcache -l 0.0.0.0 -c 1000 -t 2 -b 500 -R 100 -C -d: Run memcached as a daemon. -m: Occupied memory by Memcached in unit of MB. -p: Connection port. -u: User name running Memcached. -l: Listen IP -c: the number of simultaneous incoming connections.
Concept of iptables It is a realy rule table in which the IP communication rules are. There are groups of these rules, and it’s called “chain'.
iptables configuration Configuration file You can see the configurations in the file /etc/iptables/rule.v4. Here is a sample line in the file.
-A chain-outgoing-services -s 192.168.100.50/32 -d 1.2.3.4/32 -p tcp -m tcp --dport 22 -m comment --comment "This is a comment." -j ACCEPT http://web.mit.edu/rhel-doc/4/RH-DOCS/rhel-rg-en-4/s1-iptables-options.html
-A chain-outgoing-services: Append the rule to chain chain-outgoing-services.
/etc/security/limits.conf Concept https://wiki.archlinux.org/index.php/Limits.conf
/etc/security/limits.conf allows setting resource limits for users logged in via PAM. This is a useful way of preventing, for example, fork-bombs from using up all system resources.
Note: The file does not affect system services. For systemd services the files /etc/systemd/system.conf, /etc/systemd/user.conf, and /etc/systemd/<systemd_unit>/override.conf control the limit. See the systemd-system.conf(5) man page for details.
Config sample https://linux.die.net/man/5/limits.conf
* soft nofile 160000 The syntax of the lines is as follows:
Why rsync not SCP It can restart download (fragmentation method?).
Download a file from remote Download a folder from remote (@rsync_dir) rsync -avzhP remote_user@remote.com:/path/to/dir ./ -a: archive -h: human redable output -z: compress (like zip) data during the transfer -v: verbose -P: –partial + –progress
Sync - upload a current structure under the remotedir In dir,
rsync -ahzv ./* remote-user@remote.com:/path/to/dir/ It will overwrite the same name file!!`
Skip (almost) same contents --size-only skips files that match in size.
Regular expression Regular expression is a basic concept in theoretical computer science. Once you see the Wikipedia page of “Regular expression”, you can realize how important it is for understanding computer science.
But for beninner of web engineer, the simple explanation of regular expression could be, it is just a “pattern” in a nut shell.
Regular expression is often abbreviated to regex.
Regex rules (To be updated…) Here is often used regex syntax.
update-rc.d updates the System V style init script links /etc/rcrunlevel.d/NNname whose target is the script /etc/init.d/name.
To set the start and kill priority we simply add them to the above update-rc.d command with the start priority first, followed by the kill priority.
update-rc.d apache2 defaults [START] [KILL] The below command will start mysql first, then apache2. On shutdown, the kill will be the reverse of the start with apache2 being killed first and mysql second.