Last active
September 3, 2024 09:38
-
-
Save unicornist/60c70a8fd02bf8721969b7ce6b425982 to your computer and use it in GitHub Desktop.
Revisions
-
unicornist revised this gist
Nov 15, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ yum -y install git to check/set server timezone and enable NTP time sync: ```bash timedatectl set-timezone UTC #Asia/Dubai timedatectl set-ntp on systemctl enable --now chronyd ## check status @@ -34,12 +34,12 @@ timedatectl 1.Setup a Proxy (if needed) --- Replace `USER` and `PASS` and `PROXY` for proxy settings. ```bash export https_proxy=http://USER:PASS@PROXY:443/ vim /etc/yum.conf #proxy=http://PROXY:443/ #proxy_username=USER #proxy_password=PASS ``` -
unicornist revised this gist
Sep 7, 2021 . 1 changed file with 18 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -158,6 +158,8 @@ npm i -g gulp gulp-cli bower 4.MongoDB --- You can make a yum repo config and install everything with a single command like: ```bash vim /etc/yum.repos.d/mongodb-org-4.4.repo ``` @@ -176,13 +178,26 @@ then press <kbd>esc</kbd> then type `:wq` and press <kbd>enter</kbd> ```bash yum install -y mongodb-org ``` **OR** you can install all mongodb packages separately directly with their RPM links found in [this link](https://repo.mongodb.org/yum/redhat/7/mongodb-org/). PS: You have to install them in order to prevent dependancy errors. ```bash yum install -y https://repo.mongodb.org/yum/redhat/7/mongodb-org/???/x86_64/RPMS/mongodb-org-??????.el7.x86_64.rpm ``` After installing, run and check like this: ```bash systemctl start mongod systemctl enable mongod #mongo mongosh ``` Please also consider disabling Transparent Huge Pages for better performance: https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/ 5.Redis --- -
unicornist revised this gist
Jul 16, 2021 . 1 changed file with 15 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -82,9 +82,21 @@ systemctl restart mysqld #mysql> show databases; ``` For creating a new DB and user and grant permissions, replace `db_name`, `newuser`, `password`, and possibly `localhost` in the following commands, and run it. ```bash mysql -u root -p CREATE DATABASE db_name; CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON db_name.* TO 'newuser'@'localhost'; FLUSH PRIVILEGES; ``` 3.PHP --- To install PHP 7.4 with a bunch of commonly usded modules, run the following: ```bash yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php74 @@ -98,16 +110,15 @@ systemctl restart httpd #rm /var/www/html/info.php ``` ### PHPMyAdmin ```bash yum install -y phpmyadmin systemctl restart httpd ``` 4.FTP Server --- ```bash -
unicornist revised this gist
Jul 15, 2021 . 1 changed file with 64 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,47 @@ yum install -y httpd systemctl start httpd systemctl enable httpd #curl http://127.0.0.1/ setsebool -P httpd_unified 1 chmod -R 755 /var/www mkdir /etc/httpd/sites-available /etc/httpd/sites-enabled echo 'IncludeOptional sites-enabled/*.conf' >> /etc/httpd/conf/httpd.conf ``` Now for each vistual server (e.g. `example.com` hostname) do the following ```bash mkdir -p /var/www/example.com/html mkdir -p /var/www/example.com/log semanage fcontext -a -t httpd_log_t "/var/www/example.com/log(/.*)?" restorecon -R -v /var/www/example.com/log ls -dZ /var/www/example.com/log echo 'example.com' > /var/www/example.com/html/index.html vim /etc/httpd/sites-available/example.com.conf ``` now in the config file you can use a minimal config like this: ``` <VirtualHost *:80> ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/example.com/html ErrorLog /var/www/example.com/log/error.log CustomLog /var/www/example.com/log/requests.log combined </VirtualHost> ``` And finally with a sudoer user run the following, or if already su replace $USER with a username manually: ```bash sudo chown -R $USER:$USER /var/www/example.com/html ``` And for enabling any site ```bash ln -s /etc/httpd/sites-available/example.com.conf /etc/httpd/sites-enabled/example.com.conf systemctl restart httpd ``` 2.MySQL @@ -55,4 +96,27 @@ echo '<?php phpinfo(); ?>' > /var/www/html/info.php systemctl restart httpd #curl http://127.0.0.1/info.php #rm /var/www/html/info.php ``` 4.PHPMyAdmin --- ```bash yum install -y phpmyadmin systemctl restart httpd ``` 5.FTP Server --- ```bash yum install -y vsftpd systemctl start vsftpd systemctl enable vsftpd cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.default vim /etc/vsftpd/vsftpd.conf #anonymous_enable=NO vim /etc/vsftpd/user_list systemctl restart vsftpd ``` -
unicornist revised this gist
Jul 12, 2021 . 1 changed file with 12 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,30 +13,28 @@ systemctl enable httpd 2.MySQL --- For MariaDB Server 10.6 (40MB download, 200MB install), run: ```bash curl -sL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash - yum install -y MariaDB-server systemctl start mariadb systemctl enable mariadb mariadb-secure-installation systemctl restart mariadb #mariadb -u root -p #mariadb> show databases; ``` OR, For MySQL 8 Community Server (almost 500MB download size and 2.2GB after install), run: ```bash rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo yum --enablerepo=mysql80-community install -y mysql-community-server systemctl start mysqld systemctl enable mysqld grep "A temporary password" /var/log/mysqld.log mysql_secure_installation systemctl restart mysqld #mysql -u root -p -
unicornist renamed this gist
Jul 12, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
unicornist revised this gist
Jul 12, 2021 . 1 changed file with 60 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ **Note:** For newer versions of PHP and MariaDB, checkout their websites and update the related parts. 1.Apache2 --- ```bash yum install -y httpd systemctl start httpd systemctl enable httpd #curl http://127.0.0.1/ ``` 2.MySQL --- For MySQL 8 Community Server (almost 500MB download size and 2.2GB after install), run: ```bash rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo yum --enablerepo=mysql80-community install -y mysql-community-server systemctl start mysqld systemctl enable mysqld grep "A temporary password" /var/log/mysqld.log ``` OR, For MariaDB Server 10.6 (40MB download, 200MB install), run: ```bash curl -sL https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash - yum install -y MariaDB-server systemctl start mariadb systemctl enable mariadb mysql_secure_installation ``` Now for configuring password of `root` user and testing: ```bash mysql_secure_installation systemctl restart mysqld #mysql -u root -p #mysql> show databases; ``` 3.PHP 7.4 --- ```bash yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum-config-manager --enable remi-php74 yum install -y php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json #php -v #php --modules echo '<?php phpinfo(); ?>' > /var/www/html/info.php systemctl restart httpd #curl http://127.0.0.1/info.php #rm /var/www/html/info.php ``` -
unicornist revised this gist
May 20, 2021 . 1 changed file with 11 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -333,7 +333,7 @@ vim /etc/ssh/config service sshd reload ``` ### Yum: ```bash yum list | grep mongo @@ -344,7 +344,8 @@ yum makecache fast package-cleanup --oldkernels --count=1 #for disk cleanup (reboot first to make sure you are using latest downloaded kernel) ``` ### Copying files: `source` and/or `destination` could be either a local path or a remote path (in `host:/path` format). ```bash scp -p source destination @@ -354,43 +355,43 @@ rsync -azvhP source destination #for fewer files with larger sizes rsync -ah --info=progress2 source destination #for more files with smaller sizes ``` ### Check Disk Space: ```bash df -h #look for the one mounted at / du -sh #./* ``` ### Check Open Ports by Programs: ```bash netstat -tulpn ``` ### Get unique IPs from a file: ```bash grep -Po '\d+\.\d+\.\d+\.\d+' /var/log/nginx/access.log | uniq | sort grep -Po '\d+\.\d+\.\d+\.\d+' /var/log/nginx/access.log | uniq | wc -l ``` ### Change hostname: ```bash #hostnamectl hostnamectl set-hostname hostname echo 127.0.0.1 hostname >> /etc/hosts ``` ### Passwordless SSH: ```bash ssh-keygen # to create id_rsa & id_rsa.pub ssh-copy-id SERVER # use password to store your id_rsa.pub into the remote account's authorized_keys ``` ### Bash Completions: ```bash yum install -y bash-completion bash-completion-extras @@ -407,7 +408,8 @@ echo 'export GIT_PS1_SHOWCOLORHINTS=1 GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASH echo "export PROMPT_COMMAND='"'__git_ps1 "\033[1;34m[\033[1;36m\u\033[36m@\h\033[1;34m:\w]\\\$\033[m" "\n> "'"'" >> /etc/bashrc ``` ### SSH Banner: you can use some online [ASCII art generator service](https://patorjk.com/software/taag/#p=display&h=1&f=Isometric3&t=name) ```bash vim /etc/issue -
unicornist revised this gist
May 20, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -312,7 +312,7 @@ source ~/.docker_aliases 9.Usefull Commands (Bonus) --- ### Adding Users: When editing `authorized_keys` file for each user, paste that user's public keys from each of his machines in a separate line. -
unicornist revised this gist
May 20, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -312,7 +312,9 @@ source ~/.docker_aliases 9.Usefull Commands (Bonus) --- ##### Adding Users: When editing `authorized_keys` file for each user, paste that user's public keys from each of his machines in a separate line. ```bash adduser username -
unicornist revised this gist
May 20, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -381,21 +381,21 @@ hostnamectl set-hostname hostname echo 127.0.0.1 hostname >> /etc/hosts ``` ##### Passwordless SSH: ```bash ssh-keygen # to create id_rsa & id_rsa.pub ssh-copy-id SERVER # use password to store your id_rsa.pub into the remote account's authorized_keys ``` #### Bash Completions: ```bash yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` ### Colored Bash Prompt (with Git Prompt): you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: 🔴red=31, 🟢green=32, 🟡yellow=33, 🔵blue=34, 🟣purple=35, 💧cyan=36) ```bash -
unicornist revised this gist
May 20, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -395,7 +395,7 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` #### Colored Bash Prompt (with Git Prompt): you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: 🔴red=31, 🟢green=32, 🟡yellow=33, 🔵blue=34, 🟣purple=35, 💧cyan=36) ```bash -
unicornist revised this gist
May 20, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -395,7 +395,7 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` ##### Colored Bash Prompt (with Git Prompt): you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: 🔴red=31, 🟢green=32, 🟡yellow=33, 🔵blue=34, 🟣purple=35, 💧cyan=36) ```bash -
unicornist revised this gist
May 20, 2021 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -395,7 +395,8 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` ###### Colored Bash Prompt (with Git Prompt): you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: 🔴red=31, 🟢green=32, 🟡yellow=33, 🔵blue=34, 🟣purple=35, 💧cyan=36) ```bash curl "https://raw.githubusercontent.com/git/git/$(gitver=$(git --version); echo "${gitver/git version /v}")/contrib/completion/git-prompt.sh" > /etc/.git-prompt.sh -
unicornist revised this gist
Apr 24, 2021 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -381,6 +381,13 @@ hostnamectl set-hostname hostname echo 127.0.0.1 hostname >> /etc/hosts ``` **Passwordless SSH:** ```bash ssh-keygen # to create id_rsa & id_rsa.pub ssh-copy-id SERVER # use password to store your id_rsa.pub into the remote account's authorized_keys ``` **Bash Completions:** ```bash -
unicornist revised this gist
Apr 24, 2021 . 1 changed file with 11 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -113,22 +113,25 @@ cat /proc/<nginx-pid>/limits ``` **For SSL:** first install certbot with it's nginx extentions like below, then run it to issue or install the certificate(s) for your domain(s). Make sure to create your nginx config for those domains in `/etc/nginx/conf.d/DOMAN.conf`, and your `server_name` is similiar to the domain you will issue a certificate for. ```bash yum install -y certbot python2-certbot-nginx #certbot certonly --nginx #only issues certificate #certbot install --nginx #only installs an already issued certificate certbot #issues and installs certificate ``` Alternatively, replace DOMAIN and EMAIL in the following with yours, and choose to run the one that suits you (wildcard or non-wildcard certificate) ```bash # for non-wildcard certificates (automatic challange resolving & renewable): certbot certonly --nginx --non-interactive --agree-tos --redirect -m [email protected] -d www.DOMAIN.com echo "0 0,12 * * * root certbot renew" | sudo tee -a /etc/crontab > /dev/null # for wildcard certificates (manual issue and renew by resolving dns challange each 3 month): certbot certonly --agree-tos --manual --manual-public-ip-logging-ok --preferred-challenges dns-01 -m [email protected] -d "*.DOMAIN.com,DOMAIN.com" ``` 3.Node -
unicornist revised this gist
Feb 3, 2021 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -362,6 +362,14 @@ du -sh #./* netstat -tulpn ``` **Get unique IPs from a file:** ```bash grep -Po '\d+\.\d+\.\d+\.\d+' /var/log/nginx/access.log | uniq | sort grep -Po '\d+\.\d+\.\d+\.\d+' /var/log/nginx/access.log | uniq | wc -l ``` **Change hostname:** ```bash -
unicornist revised this gist
Feb 3, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -104,7 +104,7 @@ For preventing `(24: Too many open files)` errors in nginx, since defaults of ul echo "[Service]" >> /etc/systemd/system/nginx.service.d/override.conf echo "LimitNOFILE=65536" >> /etc/systemd/system/nginx.service.d/override.conf systemctl daemon-reload ## Add the following to your main nginx.conf (this number is suitable for 4 workers) # worker_rlimit_nofile 16384; systemctl restart nginx ## Check with the following -
unicornist revised this gist
Feb 3, 2021 . 1 changed file with 19 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,15 +86,32 @@ service nginx start chkconfig nginx on ``` For preventing 403 and permission errors for nginx, if SELinux is in enforcing mode (check with `getenforce`) use the following to allow serving static files ```bash setsebool -P httpd_can_network_connect on setsebool -P httpd_setrlimit on chcon -Rt httpd_sys_content_t /var/www # OR /usr/share/nginx/html/ ``` If the configuration above did not resolve permission issues with nginx filea read or proxying, please read https://www.nginx.com/blog/using-nginx-plus-with-selinux/ For preventing `(24: Too many open files)` errors in nginx, since defaults of ulimit is low (1024 soft, 4096 hard), you can increase it just for the nginx processes by setting specific configurations in it's systemd service file, like this: ```bash # systemctl edit nginx echo "[Service]" >> /etc/systemd/system/nginx.service.d/override.conf echo "LimitNOFILE=65536" >> /etc/systemd/system/nginx.service.d/override.conf systemctl daemon-reload ## Add the following to your main nginx.conf # worker_rlimit_nofile 16384; systemctl restart nginx ## Check with the following ps aux | grep nginx cat /proc/<nginx-pid>/limits ``` **For SSL:** create your nginx server in `/etc/nginx/conf.d/DOMAN.conf`, replace DOMAIN and EMAIL in the following with yours, and run the following: -
unicornist revised this gist
Dec 11, 2020 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -339,6 +339,12 @@ df -h #look for the one mounted at / du -sh #./* ``` **Check Open Ports by Programs:** ```bash netstat -tulpn ``` **Change hostname:** ```bash -
unicornist revised this gist
Dec 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -298,7 +298,7 @@ source ~/.docker_aliases adduser username passwd -d username su username mkdir -p ~/.ssh chmod 700 ~/.ssh vim ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys -
unicornist revised this gist
Dec 7, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ **Note:** For newer versions of NodeJS, Nginx and MongoDB, checkout their websites and update the related parts. 0.Pre-requisites --- -
unicornist revised this gist
Dec 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -354,7 +354,7 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` **Colored Bash Prompt (with Git Prompt):** you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: 🔴red=31, 🟢green=32, 🟡yellow=33, 🔵blue=34, 🟣purple=35, 💧cyan=36) ```bash curl "https://raw.githubusercontent.com/git/git/$(gitver=$(git --version); echo "${gitver/git version /v}")/contrib/completion/git-prompt.sh" > /etc/.git-prompt.sh -
unicornist revised this gist
Dec 6, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,6 +47,7 @@ vim /etc/yum.conf OR a DNS proxy in the system level dns: ```bash ##yum install -y NetworkManager-tui #nmtui vim /etc/resolv.conf #nameserver 185.51.200.2 -
unicornist revised this gist
Dec 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -318,7 +318,7 @@ yum downgrade mongodb* yum remove mongodb* yum clean all yum makecache fast package-cleanup --oldkernels --count=1 #for disk cleanup (reboot first to make sure you are using latest downloaded kernel) ``` **Copying files:** `source` and/or `destination` could be either a local path or a remote path (in `host:/path` format). -
unicornist revised this gist
Dec 6, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -353,7 +353,7 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` **Colored Bash Prompt (with Git Prompt):** you can change prompt colors by changing `1;34m` and `36m` from the last line (add/remove `1;` for light/bold switch or use other numbers for other colors: red=31, green=32, yellow=33, blue=34, purple=35, cyan=36) ```bash curl "https://raw.githubusercontent.com/git/git/$(gitver=$(git --version); echo "${gitver/git version /v}")/contrib/completion/git-prompt.sh" > /etc/.git-prompt.sh -
unicornist revised this gist
Dec 3, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -324,7 +324,8 @@ package-cleanup --oldkernels --count=1 #for disk cleanup **Copying files:** `source` and/or `destination` could be either a local path or a remote path (in `host:/path` format). ```bash scp -p source destination scp -rp source destination docker cp source destination #use docker container ID instead of host name rsync -azvhP source destination #for fewer files with larger sizes rsync -ah --info=progress2 source destination #for more files with smaller sizes -
unicornist revised this gist
Dec 3, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -352,7 +352,7 @@ yum install -y bash-completion bash-completion-extras source /etc/profile.d/bash_completion.sh ``` **Colored Bash Prompt (with Git Prompt):** you can change prompt colors by changing `1;34m` and `36m` from the last line (remove `1;` for light/bold switch or use `31m` to `36m` for other colors) ```bash curl "https://raw.githubusercontent.com/git/git/$(gitver=$(git --version); echo "${gitver/git version /v}")/contrib/completion/git-prompt.sh" > /etc/.git-prompt.sh -
unicornist revised this gist
Dec 3, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -365,6 +365,7 @@ echo "export PROMPT_COMMAND='"'__git_ps1 "\033[1;34m[\033[1;36m\u\033[36m@\h\033 ```bash vim /etc/issue # Put banner content here vim /etc/ssh/sshd_config # Banner /etc/issue service sshd restart -
unicornist revised this gist
Dec 3, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -361,7 +361,7 @@ echo 'export GIT_PS1_SHOWCOLORHINTS=1 GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASH echo "export PROMPT_COMMAND='"'__git_ps1 "\033[1;34m[\033[1;36m\u\033[36m@\h\033[1;34m:\w]\\\$\033[m" "\n> "'"'" >> /etc/bashrc ``` **SSH Banner:** you can use some online [ASCII art generator service](https://patorjk.com/software/taag/#p=display&h=1&f=Isometric3&t=name) ```bash vim /etc/issue
NewerOlder