domingo, 26 de julho de 2020

Install MySQL on Debian


wget http://repo.mysql.com/mysql-apt-config_0.8.15-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
sudo apt update 
sudo apt install mysql-server
sudo systemctl restart mysql
sudo mysql_secure_installation
mysql -u root -p

Install PHP 7.3 on Debian 9 / Debian 8




sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
sudo apt update
sudo apt -y install php7.3

Common Alias

For Debian

vi .bashrc
alias get='sudo apt-get install -y'
alias df='df -h'
alias ls='ls -la'
alias upgrade='sudo apt-get update -y && sudo apt-get autoremove -y'
alias cdwww='cd /var/www/html'
alias myip='curl ifconfig.me'
alias version='lsb_release -a'

For CentOS

vi .bashrc
alias get='sudo yum install -y'
alias df='df -h'
alias ls='ls -la'
alias upgrade='sudo yum update -y'
alias cdwww='cd /var/www/html'
alias myip='curl ifconfig.me'
alias version='hostnamectl'

Debian Upgrade

## First check version

cat /etc/debian_version
uname -a

## From Debian 8 (jessie) to 9 (stretch)

sed -i 's/jessie/stretch/g' /etc/apt/sources.list

apt update -y && apt upgrade -y
apt dist-upgrade

apt autoremove
reboot

## From Debian 9 (stretch) to 10 (buster)
sed -i 's/stretch/buster/g' /etc/apt/sources.list

apt update -y && apt upgrade -y

apt dist-upgrade

apt autoremove
reboot

sábado, 25 de julho de 2020

First server configuration

apt update -y && apt upgrade -y
apt install sudo

### Create user
export USERNAME='user'
export PASSWORD='userpassword'
useradd -m -p $(openssl passwd -1 ${PASSWORD}) -s /bin/bash -G sudo ${USERNAME}
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

### SSH Config
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bkp
sed '/MaxAuthTries/d' /etc/ssh/sshd_config.bkp > /etc/ssh/sshd_config
echo "MaxAuthTries 3" >> /etc/ssh/sshd_config
grep "^MaxAuthTries" /etc/ssh/sshd_config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bkp
sed '/PermitRootLogin/d' /etc/ssh/sshd_config.bkp > /etc/ssh/sshd_config
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
grep "^PermitRootLogin" /etc/ssh/sshd_config

/etc/init.d/ssh restart

### Install the Basics
apt install curl git net-tools build-essential tmux screen

sexta-feira, 27 de junho de 2014

Source

Install Apache:
# yum install httpd -y
 
Start the Apache service and let it to start automatically on every reboot:
# service httpd start
# chkconfig httpd on
 
Install MySQL
# yum install mysql mysql-server -y
 
Start the MySQL service and make to start automatically on every reboot.
# service mysqld start
# chkconfig mysqld on 

Setup MySQL root password
By default, mysql root user doesn’t has password. To secure mysql, we have to setup mysql root user password.
# mysql_secure_installation


Install PHP
# yum install php -y
 
Restart httpd service:
# service httpd restart
# yum install php-mysql -y



Install EPEL (Extra Packages for Enterprise Linux.)
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh epel-release-6-8.noarch.rpm
# yum repolist
 
Now install phpMyAdmin
# yum install phpmyadmin -y 

Edit the phpmyadmin.conf file.
# vi /etc/httpd/conf.d/phpMyAdmin.conf
Find and comment the whole /<Directory> section as shown below:


# cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php 
# vi /usr/share/phpMyAdmin/config.inc.php

Change cookie to http.

Restart the Apache service:
# service httpd restart