This is a mishmash of things to remember when creating linux servers, and just shit for me to remember in general reguarding linux.
- General Ubuntu Server jazz
- Debian Specific Jazz
These are common things I do when I create a ubuntu server
hostnamectl set-hostname new-host-namesudo nano /etc/hosts2nd line needs to be changed tonew-host-name
sudo nano ~/.bashrc- Uncomment:
force_color_prompt=yes - Restart your terminal
sudo nano ~/.bashrc- Scroll down to bottom
- Add
alias cls='clear'<-- This will makeclsrun theclearcommand
- Navigate to home
- Create startup script file:
nano startup-script.sh - Make it executable:
//TODO - Open Cron:
crontab -e - Add
@reboot /home/user/startup-script.shto the end of the file - Exit & test!
- Navigate to home
- Create startup script file:
nano startup-script-root.sh - Make it executable:
//TODO - Open Cron:
sudo crontab -e - Add
@reboot /home/user/startup-script-root.shto the end of the file - Exit & test!
//TODO
//TODO
//TODO
//TODO
sudo systemctl restart nginxsudo systemctl status nginx
//TODO
Instructions how to do everything with SAMBA and get it working with Windows.
sudo apt-get purge samba samba-commonsudo rm -rf /etc/samba/ /etc/default/sambasudo apt-get install samba
Had some weird issues with users, so we create a share user, the share user will own all the files created on the samba share
adduser --system shareuserchown -R shareuser /path/to/share
sudo nano /etc/samba/smb.conf- Template:
[myshare] # Share name that appears on other computers. No spaces
comment = My Amazing Share # A viewable comment describing what the share is
path = /path/to/share # Absolute path to file share
writeable = yes # We want to be able to write to the share
browseable = yes # We want to browse the file share
public = yes # Don't remember but this fixed weird shit
create mask = 0777 # Make every file executable read and writable. Probs not the best idea but like it works...
directory mask = 0777 # Make every folder executable read and writable. Probs not the best idea but like it works...
force user = shareuser # Force the user to be the share user we created above- Example:
[photos]
comment = Family photos
path = /home/eric/photos
writeable = yes
browseable = yes
public = yes
create mask = 0777
directory mask = 0777
force user = shareusersudo systemctl restart smbd
Useful screen commands
screen -S 'Screen-Name' -dm bash -c "cd /home/user/directory/; java -jar Program.jar"
CTRL + A:sessionname name
CTRL + D
CTRL + C
- screen -> Run things in the background
- htop -> Better TOP command, view programs, kill them. Must run as SUDO to kill things
- lolcat -> Rainbowify text
Specific weird quirks that Ubuntu normally would do for us, but Debian doesn't
When prompted to select a mirror, choose mirrors.edge.kernel.org because its fast.
Needed to install networking. Installs apache2, we need to uninstall to afterard.
su -apt-get update && apt-get upgrade -y- After this you can use apt and not apt get
Sudo isn't installed by default.
apt install sudonano /etc/sudoersReplace %sudo with username
sudo apt remove apache2sudo apt autoremove -y
sudo apt install ufwsudo ufw allow sshsudo ufw allow httpsudo ufw allow httpssudo ufw allow ftp
sudo systemctl enable sshsudo systemctl start ssh