Postgres is my favourite SQL tool.
#!/bin/bash
sudo apt install curl ca-certificates gnupg -y
# possu
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
sudo apt update
sudo apt install -y postgresql-14 -y
sudo systemctl status postgresql
sudo systemctl enable postgresql
sudo systemctl start postgresql
# pgadmin
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list'
sudo apt update
sudo apt install pgadmin4 -y
sudo ufw allow http
sudo ufw allow https
#!/bin/bash -i
printf "\nUpdating package lists...\n\n"
sudo apt-get update
printf "\n\nInstalling dependencies...\n\n"
sudo apt install wget curl software-properties-common build-essential libnss3-dev zlib1g-dev libgdbm-dev libncurses5-dev libssl-dev libffi-dev libreadline-dev libsqlite3-dev libbz2-dev -y
cd /usr/src
printf "\n\nDownloading Python...\n\n"
sudo wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tar.xz
printf "\n\nExtracting package...\n\n"
sudo tar -xf Python-3.10.4.tar.xz
sudo rm Python-3.10.4.tar.xz
cd Python-3.10.4/
printf "\n\nConfiguring Python...\n\n"
sudo ./configure --prefix=/usr --enable-optimizations
wait
printf "\n\nInstalling Python...\n\n"
sudo make -j 6
sudo make altinstall
wait
cd $HOME
printf "\n\nDownloading Pip...\n\n"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
wait
printf "\n\nInstalling Pip...\n\n"
sudo python3.9 get-pip.py
rm get-pip.py
printf "\n\nInstalling Virtualenvwrapper...\n\n"
sudo pip3 install virtualenvwrapper
if [[ ! -d $HOME/Devel ]]; then
mkdir $HOME/Devel
fi
if [[ ! -d $HOME/.virtualenvs ]]; then
mkdir $HOME/.virtualenvs
fi
echo "export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.9
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /usr/bin/python3.9 '
export PROJECT_HOME=$HOME/Devel
source /usr/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
read -p 'Give name to your virtualenv: ' envname
printf "\n\nMaking new virtual environment $envname...\n\n"
mkvirtualenv $envname
source ~/.bashrc
workon $envname
PS3='What tools you want to install? '
options=("Django" "Arcade & PyMunk" "BeautifulSoup" "Jinja2" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Django")
printf "\n\nInstalling Django...\n\n"
pip3 install django
;;
"Arcade & PyMunk")
printf "\n\nInstalling Pymunk and Arcade...\n\n"
python3.7 -m pip install -U pymunk arcade
;;
"BeautifulSoup")
pip3 install beautifulsoup4
;;
"Jinja2")
pip3 install Jinja2
;;
"Quit")
break
;;
*) echo "invalid option $REPLY";;
esac
done
I wrote this script in 2019 while working at Cinia, I have removed some lines which were confidential
#!/bin/bash
###############
local_user=`awk -F: '$3 == 1000 { print $1}' /etc/passwd`
if=$(awk '$2 == 00000000 { print $1 }' /proc/net/route)
local_ip=`ip addr show dev "$if" | awk '$1 == "inet" { sub("/.*", "", $2); print $2 }'`
###############
printf "This script installs:\n\t- JDK 11\n\t- Maven 3.6.1\n\t- MySQL Server 5.7.x\n\t- latest Git\n\t- latest MongoDB\n\t- latest Docker\n\t- latest Docker Compose\n"
read -p "Press ENTER to continue."
sudo apt-get update
sudo apt-get install -y build-essential curl apt-transport-https ca-certificates gnupg-agent software-properties-common
####### GIT #######
sudo apt-get install -y git
####### OPENJDK-11 #######
sudo apt-get install -y openjdk-11-jdk
####### MAVEN #######
cd /opt/
curl -O http://www-eu.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz
wait
sudo tar -xzf apache-maven-3.6.1-bin.tar.gz
wait
sudo mv apache-maven-*/ maven/
sudo rm apache-maven-*-bin.tar.gz
sudo update-alternatives --install /usr/bin/mvn maven /opt/maven/bin/mvn 1001
cd /etc/profile.d/
sudo touch maven.sh
printf 'export JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64\nexport M2_HOME=/opt/maven\nexport MAVEN_HOME=/opt/maven\nexport PATH=${M2_HOME}/bin:${PATH}' > maven.sh
sudo chmod 755 maven.sh
sudo chmod +x maven.sh
source maven.sh
####### MONGO #######
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl enable mongod
wait
sudo systemctl start mongod
wait
sudo mkdir -p /data/db/
sudo chown -R mongodb:mongodb /data/db/
cd /etc/
sudo sed -i -- 's@dbPath: /var/lib/mongodb@dbPath: /data/db@' mongod.conf
####### MYSQL #######
sudo apt-get update
sudo apt-get install -y mysql-server-5.7
cd /etc/mysql/mysql.conf.d/
sed -i -r "s/bind-address = (([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/bind-address = $local_ip/" mysqld.cnf
sudo systemctl enable mysql.service
wait
sudo systemctl start mysql.service
wait
####### DOCKER #######
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88 -y
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
cd /home/$local_user/
sudo mkdir .docker/
sudo chown $local_user:$local_user /home/$local_user/.docker/ -R
sudo chmod g+rwx /home/$local_user/.docker/ -R
wait
sudo systemctl restart docker
wait
curl -L "https://github.com/docker/compose/releases/download/1.24.0/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
#printf "\nInstall process completed, please re-login and then run the second script.\n"
#read -p "Press ENTER to return to shell."
sudo -i -u $local_user bash << EOF
source .profile
sleep 2
source .bashrc
EOF
####### docker to non-sudo #######
echo "Do you want to use Docker without sudo? (not recommended) [y/n]"
while read -r input
do
if [[ $input == "Y" || $input == "y" ]]; then
read -p "Press ENTER to make it"
sudo -i -u $local_user bash << EOF
sudo chmod 666 /var/run/docker.sock
EOF
break
elif [[ $input == "N" || $input == "n" ]]; then
:
break
else
echo "That was a strange input... let's try again."
echo "Do you want to use Docker without sudo? (not recommended) [y/n]"
fi
done
####### SSH key #######
read -p 'Write your email address for generating new SSH-key: ' email
ssh-keygen -o -t rsa -b 4096 -C "$email" -f /home/$local_user/.ssh/id_rsa
cd /home/$local_user/.ssh/
sudo chown $local_user:$local_user id_rsa
wait
I like to use DAS layout, which is designed for finnish typing
#!/bin/bash
sudo apt install curl
curl http://cristian.seres.fi/das-installer.py -o das-installer.py
sudo python3 das-installer.py
wait
rm das-installer.py
cd /usr/bin/
setxkbmap fi -variant das
if which gdebi > /dev/null 2> /dev/null
then
cd /etc/default/
wait
sudo sed -i 's@XKBVARIANT=""@XKBVARIANT="das"@g' keyboard # Debian-based
else
cd /etc/X11/xorg.conf.d/
sed '8s/$/ Option "XkbVariant" "das"/' 00-keyboard.conf #OpenSUSE
fi