Created
March 31, 2015 18:26
-
-
Save blikenoother/0b15b986cbb7cd2a88e9 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 | |
# system update upgrade | |
apt-get update && sudo apt-get -y upgrade | |
# install docker | |
wget -qO- https://get.docker.com/ | sh | |
# generate random password | |
ZPANLE_ADMIN_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) | |
POSTFIX_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) | |
MYSQL_ROOT_PASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1) | |
# pull docker image and create container | |
docker pull infoglans/zpanelcp:10.1.3 | |
docker create --name=zpanelcp -v /data/mysql:/var/lib/mysql -v /data/www:/var/zpanel/hostdata -p 80:80 -p 21:21 -p 25:25 -p 2222:2222 -p 443:443 -p 20:20 -p 110 -p 143 -p 3306:3306 -e zadminNewPass=$ZPANLE_ADMIN_PASS -e postfixpassword=$POSTFIX_PASS -e mysqlPassword=$MYSQL_ROOT_PASS infoglans/zpanelcp:10.1.3 bash /opt/runserver.sh | |
docker stop zpanelcp | |
# create service to start container (service zpanelcp start|stop) | |
wget "https://gist.githubusercontent.com/blikenoother/d417c09dbd1a6c8ef933/raw/d2583f957550c16215668430f5245862ac550fb0/zpanelcp.conf" | |
mv zpanelcp.conf /etc/init/ | |
service zpanelcp start | |
# ftp passive access work around | |
CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' zpanelcp) | |
iptables -t nat -I PREROUTING -p tcp --dport 60000:62000 -j DNAT --to "$CONTAINER_IP:60000-62000" | |
echo "|========================================================|" | |
echo "| Password |" | |
echo "|========================================================|" | |
echo "| |" | |
echo "| Zpanel => user: zadmin password: $ZPANLE_ADMIN_PASS |" | |
echo "| MySQL => user: root password: $MYSQL_ROOT_PASS |" | |
echo "| Postfix => user: - password: $POSTFIX_PASS |" | |
echo "| |" | |
echo "|========================================================|" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment