bigfoot31
6/15/2018 - 9:56 PM

linux system one liner

linux system one liner

install pip

pip install pip2pi

pip repo

dir2pi .

add pip repo info to ~/.pip/pip.conf

[global] index-url = {{ PIP_LOCATION }}

to download packages

pip install --download . package

create yum repo

yum install -y -q yum-utils

update yum cache

yum clean all

add repo metadata to /etc/yum.repos.d/localrepo.repo

[localrepo] name=Hotscan Repository baseurl=ftp://{{ LOCALREPO_FTP_URL }}/pub gpgcheck=0 enabled=1

yum proxy /etc/yum.conf

proxy=http://<Proxy-Server-IP-Address>:<Proxy_Port> proxy_username=<Proxy-User-Name> proxy_password=<Proxy-Password>

install ftp server

yum install -y -q vsftpd

start ftp server

systemctl start vsftpd sysremctl enabled vsftpd

cp all rpm files to /var/ftp/pub

createrepo /var/ftp/pub

open port 21 on firewall

firewall-cmd --permanent --port 21/tcp

to download necessary rpm

yum install --downloadonly --downloaddir=. package yum reinstall --downloadonly --downloaddir=. package

# install yum-config-manager
yum install -y -q yum-utils

# create user and group
useradd <user> -g <group> 
passwd <passwd>
groupadd <group>
gpasswd <passwd>
userdel
usermod
groupdel
groupmod

# stop firewall
systemctl stop firewalld

# configure firewall
firewall-cmd --get-active-zones
firewall-cmd --zone=public --add-port=3127/tcp --permanent
firewall-cmd --reload

# nohup 
nohup command &>/dev/null &

# kill ports
yum install psmisc
fuser 80/tcp

# add service to boot
chkconfig <service> on

generate aws keygen

ssh-keygen -P "" -t rsa -b 4096 -m pem -f < name >.pem

cat < name >.pem.pub >> .ssh/authorized_keys

rm -rf < name >.pem.pub

additional steps for first time

mkdir .ssh

chmod 700 .ssh/

touch .ssh/authorized_keys

chmod 600 .ssh/authorized_keys

start ssh-agent

eval $(ssh-agent)

add private key to ssh

ssh-add ~/.ssh/user_rsa

copy ssh key to server

ssh-copy-id -i file user@host

host checking turn off

~/.ssh/config Host * StrictHostKeyChecking nosudo chmod 400 ~/.ssh/config

install htpasswd

yum install -y -q httpd-tools

install squid proxy

yum install -y -q squid htpasswd -c /etc/squid/passwd hotscan

configuration of squid proxy

vi /etc/squid/squid.conf

allowed network

acl localnet src 192.168.163.0/24

access port

http_port 3127

authentication

auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd auth_param basic realm proxy acl authenticated proxy_auth REQUIRED http_access allow authenticated

jupyter notebook --no-browser --port=8889
ssh -N -f -L localhost:8888:localhost:8889 username@your_remote_host_name
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
 
sudo mkfs -t xfs /dev/xvdf
sudo mkdir ~/data
sudo mount /dev/xvdf /data