# - bof - #

#!/bin/bash



<<'comment'
cd ~/; rm -rf ~/uServerContainer(LXC).sh; vim ~/uServerContainer(LXC).sh;
# - Copy & paste this content - #
chmod +x ~/uServerContainer(LXC).sh; ~/./uServerContainer(LXC).sh;

ssh-keygen -R 10.0.0.210
cd ~/; curl -O http://10.0.0.100/DataPool/Images/Programs/Linux.Img/Linux_Ubuntu.Img/Ubuntu_Server.Img/1-Linux_Configuration_Files/General-Documentation_uServer/uServer_Setup-Configuration_Updated/uServerConf.sh;

chmod +x ~/uServerConf.sh; ~/./uServerConf.sh;
~/./uServerConf.sh;



# -  - #
# - When this error happen on ssh command - #

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

# -  - #
# - Fixing this error - #
ssh-keygen -R "you server hostname or ip"
ssh-keygen -R 192.168.1.100;
ssh-keygen -R 192.168.1.200;
ssh-keygen -R 192.168.122.100;
ssh-keygen -R 192.168.122.200;
comment

<<'comment'
  Comment here...
comment



clear;



# -  - #
# - uServer(LXC) container - #
Create an uServer(LXC) container on ProxmoxVEServer

# -  - #
# - Documentation - #
https://www.youtube.com/watch?v=h8qEXBp--WU
https://www.wundertech.net/how-to-set-up-docker-containers-in-proxmox/



# :a
# -  - #
# - Download templates in ProxmoxVEServer - #
sshP;
ssh root@10.0.0.50

pveam update;
pveam available;

# - Download from the website or - #
pveam download ISOs ubuntu-23.04-standard_23.04-1_amd64.tar.zst;


# :c
# -  - #
# - Create LXC Container - #

 General:
    Node: proxmox
   CT ID: 107
Hostname: uServerLXC-Docker
Hostname: uServerLXC-WebServer

Password: xx
Confirm
Password: xx

Templete:
 Storage: ISOs
Templete: Ubuntu 23.10

Disks:
      Storage: OSs
Dis size(GiB): 30

CPU:
Cores: 4

Memory:
Memory (MiB): 1024
  Swap (MiB):  512

Network:
          Name: eth0
          iPv4: Static
     IPv4/CIDR: 10.0.0.200/24
Gateway (iPv4): 10.0.0.1

DNS:
 DNS domain: 10.0.0.1
DNS servers: 1.1.1.1,8.8.8.8,8.8.4.4



# :d
# -  - #
# - uServer login - #
root
Admin2



# :e
# -  - #
# - Update system - #
sudo apt update && sudo apt upgrade -y;
sudo apt autoremove -y;

sudo apt install ca-certificates curl gnupg htop inxi lsb-release ncdu \
                 neofetch net-tools ntp screenfetch unzip vim zip -y;



# :f
# -  - #
# - Create administrator user (is_derayo) - #
sudo adduser is_derayo;
sudo usermod -aG sudo is_derayo;
cat /etc/passwd;
cat /etc/group;



# :g
# -  - #
# - Install software - #
ssh is_derayo@10.0.0.200;



# :h
# -  - #
# - Root password - #
sudo passwd root;

sudo vim /etc/ssh/sshd_config;

/PermitRoot
PermitRootLogin yes
PasswordAuthentication yes

:wq

sudo systemctl restart sshd;



# :i
# -  - #
# - Configure .bashrc & authorized_keys - #

cd .ssh;
vim authorized_keys;

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCZt1BmNHHwmBpK2/QxKTLqB/3Vs5PbqMjPqWJYldsLH01xTYHuurJbwqN0ua+rZDPFYbSUCZaqQDbiFTkqd3UHPRoaI46nyrKc1QQ9LhilsrtYRJOoIkEGMoc+I6yqRUKKFSRlStB0Wsl4x9PXhrRDCWUNIVQ8XMb63BduqIZ/XDm/rJCCpi34GzB3JCUwm7YV/HRB0PJtLkAvfYeulHpYf3PFR8gzFJgQSjD8Cbi+tUfS5qEhiCepA5lvDUXInnQSrWpvSG+FViZVu3ezwc0PnFz3K7mhBEcMKb5o8666T8Ek/b0gclRkSFrv21JeIVJC2lL6YqsnYhbxoraKkXOjOnagbs2tIoydyO+2+MAPtWo+yj45uOvfKzZ4bG4aMJShx/HwJmUmHCHt0GzRWIfRTwbAfE1ml+nRmoGJyxRBIvOJ6c/3EqIDll0s5BwsCWVUcE/OA0mzahHZfGopSOf4fVIhP44C7wZ7TN2jdd9/7Z/V5fsElKKNfmOMXy+aTnk= is_derayo@iMacArch



# :j
# -  - #
# - Create Data folder - #

ssh is_derayo@10.0.0.200;
sudo mkdir /Data;
sudo chown -R is_derayo:is_derayo /Data;
sudo chmod -R 775 /Data;



# :k
# -  - #
# - Network configuration - #

cd /etc/systemd/network;

╭── # is_derayo@uServerLXC /etc/systemd/network :
╰─▷ $ la
total 14K
drwxr-xr-x 2 root root   3 Apr 26 23:08 ./
drwxr-xr-x 6 root root  15 Apr 26 23:15 ../
-rw-r--r-- 1 root root 156 Apr 26 23:08 eth0.network



sudo vim /etc/systemd/network/eth0.network;

[Match]
Name = eth0

[Network]
Description = Interface eth0 autoconfigured by PVE
Address = 10.0.0.200/24
Gateway = 10.0.0.1
DHCP = no
IPv6AcceptRA = false



# :l
# -  - #
# - uServer Tweaks - #
sudo vim /etc/sysctl.conf;

vm.swappiness = 10
vm.vfs_cache_pressure = 50
fs.inotify.max_user_watches = 262144



# :m
# -  - #
# - To test - #
# - Enable ufw firewall - #

#sudo ufw default deny incoming;
#sudo ufw default allow outgoing;
#sudo ufw allow from 10.0.0.0/24

#sudo ufw enable;

sudo ufw status;
sudo ufw status numbered;








# - eof - #