Forked from jnhwkim/Install git, nginx, mysql, mongodb, redis, node.js(+nvm), and mono on Ubuntu
Created
November 15, 2022 17:32
-
-
Save dunguyenn/0abf9e04240a6e3deaf06528cdf4efcc to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/bash | |
################################### | |
# Usage: sudo ./installer.sh [os] # | |
################################### | |
OS=$1; | |
UBUNTU="ubuntu"; | |
############# | |
# Functions # | |
############# | |
check_os() { | |
if [ "$OS" = "$UBUNTU" ]; then | |
echo "Target OS is $OS"; | |
else | |
echo "$OS is not supported"; | |
exit 1; | |
fi | |
} | |
update() { | |
echo "Updating"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo apt-get update`; | |
fi | |
} | |
install_git() { | |
echo "Installing git"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo apt-get install git-all`; | |
fi | |
} | |
install_nginx() { | |
echo "Installing nginx"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo apt-get install nginx`; | |
fi | |
} | |
install_mysql() { | |
echo "Installing mysql"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo apt-get install mysql-server`; | |
`echo mysql_secure_installation`; | |
`echo mysql_install_db`; | |
fi | |
} | |
install_mongodb() { | |
echo "Installing mongodb"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927`; | |
`echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list`; | |
update; | |
`echo apt-get install -y mongodb-org`; | |
fi | |
} | |
install_redis() { | |
echo "Installing redis"; | |
if [ "$OS" == "$UBUNTU" ]; then | |
`echo apt-get install build-essential`; | |
`echo apt-get install tcl8.5`; | |
`echo wget http://download.redis.io/releases/redis-stable.tar.gz && tar xzf redis-stable.tar.gz`; | |
`echo cd redis-stable`; | |
`echo make`; | |
`echo make test`; | |
`echo make install`; | |
`echo cd utils`; | |
`echo ./install_server.sh`; | |
fi | |
} | |
install_nodejs() { | |
echo "Installing node.js"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
# install node.js | |
`echo apt-get install nodejs`; | |
# install nvm | |
`echo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash`; | |
fi | |
} | |
install_mono() { | |
echo "Installing mono"; | |
if [ "$OS" = "$UBUNTU" ]; then | |
`echo sudo apt-get install mono-complete`; | |
fi | |
} | |
############## | |
# Operations # | |
############## | |
check_os; | |
install_git; | |
install_nginx; | |
install_mysql; | |
install_mongodb; | |
install_redis; | |
install_nodejs; | |
install_mono; | |
echo "All done"; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment