Compare commits
4 Commits
eac4231c1e
...
1f4bbc6a10
Author | SHA1 | Date |
---|---|---|
Ray Elliott | 1f4bbc6a10 | |
Ray Elliott | f7ec743fd1 | |
Ray Elliott | f0c4df0f90 | |
Ray Elliott | adc9b9d57a |
|
@ -5,3 +5,7 @@ Development environment base packages:
|
||||||
* lf
|
* lf
|
||||||
* lazygit
|
* lazygit
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* add verbose options to commands
|
||||||
|
* install-wordpress.sh - move virtual host to files/
|
||||||
|
|
|
@ -22,8 +22,9 @@ done
|
||||||
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
||||||
|
|
||||||
# update local server
|
# update local server
|
||||||
echo "Updating ..":
|
echo "Updating .."
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get update && apt-get upgrade
|
apt-get update && apt-get upgrade
|
||||||
EOSSH
|
EOSSH
|
||||||
echo "Update complete"
|
echo "Update complete"
|
||||||
|
@ -52,9 +53,10 @@ elif [ -n "$litespeed_version" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$wp_user" ] ; then
|
if [ -n "$wp_user" ] ; then
|
||||||
. "$_script_dir/install-wordpress.sh"
|
. "$_script_dir/install-wordpress.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$dev_env" ] ; then
|
if [ -n "$dev_env" ] ; then
|
||||||
. "$_script_dir/install-dev-base.sh"
|
. "$_script_dir/install-dev-base.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ fi
|
||||||
|
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
echo "Installing Apache2"
|
echo "Installing Apache2"
|
||||||
apt install -y apache2
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y apache2
|
||||||
ufw allow in "WWW Full"
|
ufw allow in "WWW Full"
|
||||||
|
|
||||||
sed -i '/export APACHE_RUN_USER=/c\export APACHE_RUN_USER='"$user" /etc/apache2/envvars
|
sed -i '/export APACHE_RUN_USER=/c\export APACHE_RUN_USER='"$user" /etc/apache2/envvars
|
||||||
|
|
|
@ -7,7 +7,8 @@ sed -i '/PasswordAuthentication/c\PasswordAuthentication no' /etc/ssh/sshd_confi
|
||||||
sed -i '/PermitRootLogin/c\PermitRootLogin prohibit-password' /etc/ssh/sshd_config
|
sed -i '/PermitRootLogin/c\PermitRootLogin prohibit-password' /etc/ssh/sshd_config
|
||||||
systemctl restart sshd
|
systemctl restart sshd
|
||||||
|
|
||||||
apt install -y ufw || (echo "ERROR while installing ufw" ; exit 15)
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y ufw || (echo "ERROR while installing ufw" ; exit 15)
|
||||||
|
|
||||||
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
|
ufw allow ssh || (echo "Error while configuring ufw to allow ssh" ; exit 20 )
|
||||||
yes | ufw enable
|
yes | ufw enable
|
||||||
|
|
|
@ -5,17 +5,18 @@ _home_dir="/home/$user"
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
|
|
||||||
echo "Installing packages .."
|
echo "Installing packages .."
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get -y install curl gnupg2 ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip fzf vim ctags
|
apt-get -y install curl gnupg2 ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip python-pip python3-pip fzf vim ctags
|
||||||
|
|
||||||
echo "Installing lazygit .."
|
echo "Installing lazygit .."
|
||||||
curl -fsSL https://github.com/jesseduffield/lazygit/releases/download/v0.22.1/lazygit_0.22.1_Linux_x86_64.tar.gz --output /tmp/lazygit.tar.gz
|
curl -fsSL https://github.com/jesseduffield/lazygit/releases/download/v0.22.1/lazygit_0.22.1_Linux_x86_64.tar.gz --output /tmp/lazygit.tar.gz
|
||||||
tar xf /tmp/lazygit.tar.gz -C /usr/local/bin/
|
tar xf /tmp/lazygit.tar.gz -C /usr/local/bin/
|
||||||
rm /tmp/lazygit.tar.gz
|
rm -v /tmp/lazygit.tar.gz
|
||||||
|
|
||||||
echo "Installing lf ..."
|
echo "Installing lf ..."
|
||||||
curl -fsSL https://github.com/gokcehan/lf/releases/download/r16/lf-linux-amd64.tar.gz --output /tmp/lf.tar.gz
|
curl -fsSL https://github.com/gokcehan/lf/releases/download/r16/lf-linux-amd64.tar.gz --output /tmp/lf.tar.gz
|
||||||
tar xf /tmp/lf.tar.gz -C /usr/local/bin/
|
tar xf /tmp/lf.tar.gz -C /usr/local/bin/
|
||||||
rm /tmp/lf.tar.gz
|
rm -v /tmp/lf.tar.gz
|
||||||
|
|
||||||
echo "Installing neovim ..."
|
echo "Installing neovim ..."
|
||||||
git clone https://github.com/neovim/neovim /tmp/neovim
|
git clone https://github.com/neovim/neovim /tmp/neovim
|
||||||
|
@ -63,7 +64,7 @@ nvim --headless +PlugInstall +qall
|
||||||
echo "Configuring lf .."
|
echo "Configuring lf .."
|
||||||
lf config
|
lf config
|
||||||
if [ -e "$_home_dir/.config/lf" ] ; then
|
if [ -e "$_home_dir/.config/lf" ] ; then
|
||||||
mv "$_home_dir/.config/lf" "$_home_dir/.config/lf-original-$(date +%s)"
|
mv -v "$_home_dir/.config/lf" "$_home_dir/.config/lf-original-$(date +%s)"
|
||||||
fi
|
fi
|
||||||
git clone ssh://git@git.rayelliott.dev:3222/dots/lf.git "$_home_dir/.config/lf"
|
git clone ssh://git@git.rayelliott.dev:3222/dots/lf.git "$_home_dir/.config/lf"
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ ssh -T $ssh << EOSSH
|
||||||
fi
|
fi
|
||||||
echo "Installing MariaDB"
|
echo "Installing MariaDB"
|
||||||
|
|
||||||
apt install -y mariadb-server
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y mariadb-server
|
||||||
|
|
||||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||||
|
|
|
@ -14,7 +14,8 @@ ssh -T $ssh << EOSSH
|
||||||
fi
|
fi
|
||||||
echo "Installing MySQL"
|
echo "Installing MySQL"
|
||||||
|
|
||||||
apt install -y mysql-server
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y mysql-server
|
||||||
|
|
||||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
$_mysql_cmd "DELETE FROM mysql.user WHERE User='';"
|
||||||
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
$_mysql_cmd "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
|
||||||
|
|
|
@ -9,7 +9,8 @@ if [ -n "$wp_user" ] ; then
|
||||||
echo 'Installing PHP for WordPress ...'
|
echo 'Installing PHP for WordPress ...'
|
||||||
|
|
||||||
ssh -T $ssh << 'EOSSH'
|
ssh -T $ssh << 'EOSSH'
|
||||||
apt install -y php libapache2-mod-php php-fpm php-bcmath php-curl php-gd php-imagick php-mbstring \
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y php libapache2-mod-php php-fpm php-bcmath php-curl php-gd php-imagick php-mbstring \
|
||||||
php-mysql php-soap php-xml php-zip
|
php-mysql php-soap php-xml php-zip
|
||||||
|
|
||||||
_php_config_file=$(php --ini | grep Loaded | awk '{ print $4 }')
|
_php_config_file=$(php --ini | grep Loaded | awk '{ print $4 }')
|
||||||
|
@ -23,6 +24,7 @@ else
|
||||||
echo 'Installing default PHP ...'
|
echo 'Installing default PHP ...'
|
||||||
|
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
apt install -y php libapache2-mod-php php-mysql
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get install -y php libapache2-mod-php php-mysql
|
||||||
EOSSH
|
EOSSH
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,17 +2,23 @@
|
||||||
|
|
||||||
_home_dir="/home/$user"
|
_home_dir="/home/$user"
|
||||||
|
|
||||||
echo "Configuring ssh keys .."
|
ssh -T $ssh << EOSSH
|
||||||
|
echo "Creating user .."
|
||||||
|
useradd -m -d "$_home_dir" "$user"
|
||||||
|
echo "$user:$user_pass" | chpasswd
|
||||||
|
usermod -aG sudo "$user"
|
||||||
|
EOSSH
|
||||||
|
|
||||||
ssh $ssh mkdir -p "$_home_dir/.ssh"
|
echo "Configuring ssh .."
|
||||||
|
|
||||||
|
ssh $ssh mkdir -v -p "$_home_dir/.ssh"
|
||||||
scp files/private/id_rsa "$ssh:$_home_dir/.ssh/"
|
scp files/private/id_rsa "$ssh:$_home_dir/.ssh/"
|
||||||
scp files/id_rsa.pub "$ssh:$_home_dir/.ssh/"
|
scp files/id_rsa.pub "$ssh:$_home_dir/.ssh/"
|
||||||
scp files/known_hosts "$ssh:$_home_dir/.ssh/"
|
scp files/known_hosts "$ssh:$_home_dir/.ssh/"
|
||||||
|
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
cp /root/.ssh/authorized_keys "$_home_dir/.ssh/authorized_keys"
|
cp -v /root/.ssh/authorized_keys "$_home_dir/.ssh/authorized_keys"
|
||||||
chown -R "$user:$group" "$_home_dir/.ssh"
|
chown -v -R "$user:$group" "$_home_dir/.ssh"
|
||||||
# add git.rayelliott.dev to known hosts
|
|
||||||
|
|
||||||
echo "Adding user: $user"
|
echo "Adding user: $user"
|
||||||
|
|
||||||
|
@ -28,31 +34,26 @@ ssh -T $ssh << EOSSH
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get --assume-yes install sudo git tmux zsh curl
|
apt-get --assume-yes install sudo git tmux zsh curl
|
||||||
|
|
||||||
echo "Creating user .."
|
|
||||||
useradd -m -d "$_home_dir" "$user"
|
|
||||||
echo "$user:$user_pass" | chpasswd
|
|
||||||
usermod -aG sudo "$user"
|
|
||||||
|
|
||||||
echo "Cloning configuration files .."
|
echo "Cloning configuration files .."
|
||||||
su --login "$user"
|
su --login "$user"
|
||||||
git config --global user.name rayelliott
|
git config --global user.name rayelliott
|
||||||
git config --global user.email dev@rayelliott.dev
|
git config --global user.email dev@rayelliott.dev
|
||||||
mkdir -p "$_home_dir/.config"
|
mkdir -v -p "$_home_dir/.config"
|
||||||
|
|
||||||
if [ -e "$_home_dir/.config/profile" ] ; then
|
if [ -e "$_home_dir/.config/profile" ] ; then
|
||||||
mv "$_home_dir/.config/profile" "$_home_dir/.config/profile-original-$(date +%s)"
|
mv -v "$_home_dir/.config/profile" "$_home_dir/.config/profile-original-$(date +%s)"
|
||||||
fi
|
fi
|
||||||
git clone ssh://git@git.rayelliott.dev:3222/dots/profile.git "$_home_dir/.config/profile"
|
git clone ssh://git@git.rayelliott.dev:3222/dots/profile.git "$_home_dir/.config/profile"
|
||||||
"$_home_dir/.config/profile/install.sh"
|
"$_home_dir/.config/profile/install.sh"
|
||||||
|
|
||||||
if [ -e "$_home_dir/.config/tmux" ] ; then
|
if [ -e "$_home_dir/.config/tmux" ] ; then
|
||||||
mv "$_home_dir/.config/tmux" "$_home_dir/.config/tmux-original-$(date +%s)"
|
mv -v "$_home_dir/.config/tmux" "$_home_dir/.config/tmux-original-$(date +%s)"
|
||||||
fi
|
fi
|
||||||
git clone ssh://git@git.rayelliott.dev:3222/dots/tmux.git "$_home_dir/.config/tmux"
|
git clone ssh://git@git.rayelliott.dev:3222/dots/tmux.git "$_home_dir/.config/tmux"
|
||||||
"$_home_dir/.config/tmux/install.sh"
|
"$_home_dir/.config/tmux/install.sh"
|
||||||
|
|
||||||
if [ -e "$_home_dir/.config/zsh" ] ; then
|
if [ -e "$_home_dir/.config/zsh" ] ; then
|
||||||
mv "$_home_dir/.config/zsh" "$_home_dir/.config/zsh-original-$(date +%s)"
|
mv -v "$_home_dir/.config/zsh" "$_home_dir/.config/zsh-original-$(date +%s)"
|
||||||
fi
|
fi
|
||||||
git clone ssh://git@git.rayelliott.dev:3222/dots/zsh.git "$_home_dir/.config/zsh"
|
git clone ssh://git@git.rayelliott.dev:3222/dots/zsh.git "$_home_dir/.config/zsh"
|
||||||
"$_home_dir/.config/zsh/install.sh"
|
"$_home_dir/.config/zsh/install.sh"
|
||||||
|
|
Loading…
Reference in New Issue