Difference between revisions of "ESXi, CentOS, Ubuntu, Docker"

From Rhomicom Wiki
Jump to navigation Jump to search
Line 113: Line 113:
 
chroot /media/sda /bin/bash
 
chroot /media/sda /bin/bash
  
#NB if /etc/shadow or /etc/passwd files are edited, you might need to disable SELINUX or restore their SELINUX settings
+
#NB if /etc/shadow or /etc/passwd files are edited manually, you might need to disable SELINUX or restore their SELINUX settings
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 18:51, 23 August 2021

Useful Commands

hostnamectl set-hostname "aws-webmin.rhomicom.com"
nano /etc/hosts

kill SIGNAL PID
kill -9 2117

fuser -k 25/tcp
fuser -k 80/tcp
fuser -k 443/tcp

lsblk -o name,rota
fdisk -l
du -s -B1 -h -c --apparent-size *
du -csh *
adduser rhouser
   passwd rhouser
   usermod -aG wheel rhouser
  su - rhouser
userdel rhouser
userdel -r rhouser  #del home dir
chkconfig --add httpd
chkconfig httpd on
chkconfig httpd off
chkconfig --del httpd
 yum -y install which openssh openssh-server openssh-clients openssl-libs nano rsync unzip net-tools NetworkManager-tui sysstat perl-core libaio nmap-ncat libstdc++.so.6 wget tar 
 yum install epel-release
 dnf --enablerepo=epel -y install sshpass
 
 #Compress
 tar -czvf zimbkp23Aug2021.tar.gz /opt/zimbra
 #Extract/Deflate
 tar -xzvf zimbkp23Aug2021.tar.gz
 #Download
 rsync -avH [email protected]:/home/user/ --progress --human-readable /home/user/Downloads/
 #UPLOAD#
 rsync -avH /home/richard/Downloads/ --progress --human-readable [email protected]:/home/user/
 rsync -avHP /home/a_bkps.tar.gz --progress --human-readable -e "ssh -i some-key.pem" [email protected]:/home/user/

Docker Commands

docker ps
docker inspect -f  "{{ .Config.Env }}" <container_id> 
docker commit --change "ENV DEBUG=true" <container_id> rhomicom/testimage:v1.0
docker inspect -f "{{ .Config.Env }}" <container_id>
docker push rhomicom/testimage:v1.0

sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker && sudo systemctl enable docker
sudo docker run hello-world

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

BackupPC

dnf update
dnf install epel-release
dnf info backuppc
dnf config-manager –set-enabled PowerTools
dnf install -y backuppc

nano /etc/BackupPC/config.pl
nano /etc/httpd/conf.d/BackupPC.conf
htpasswd -c /etc/BackupPC/.backuppc bkpadmin
chmod 666 /etc/BackupPC/.backuppc

yum -y install which openssh openssh-server openssh-clients openssl-libs nano rsync unzip net-tools NetworkManager-tui sysstat perl-core libaio nmap-ncat libstdc++.so.6 wget tar
dnf --enablerepo=epel -y install sshpass

nano /etc/httpd/conf/httpd.conf
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.old
sed -i 's/Options Indexes FollowSymLinks/Options -Indexes +FollowSymLinks/' /etc/httpd/conf/httpd.conf
httpd -t
systemctl enable --now httpd
systemctl enable --now backuppc
systemctl status backuppc
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status info
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status hosts
sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg status jobs
firewall-cmd --add-service={http,https} --permanent

systemctl restart httpd
systecmctl restart backuppc
systemctl status backuppc
htpasswd -c /etc/BackupPC/.backuppc bkpadmin
nano /etc/httpd/conf.d/BackupPC.conf

Linux Rescue Mode

mkdir -p /media/sda
mount -o exec,barrier=0 /dev/sda /media/sda
mount -o remount,exec,barrier=0 /dev/sda /media/sda
cd /media/sda
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/
chroot /media/sda /bin/bash

#NB if /etc/shadow or /etc/passwd files are edited manually, you might need to disable SELINUX or restore their SELINUX settings