I have written a script which will setup Nextcloud on a Ubuntu Docker container. Ill run through the entire process.
First we need to download the correct image into docker.
1 |
docker pull ubuntu:1604 |
Then we need to start the container with the os.
1 |
docker run -t -d -p 10000:80 -i ubuntu:16.04 /bin/bash |
Now we need to find the unique id of the container
1 |
docker ps -a |
Now on the host, so not the container. Create the script.
1 |
vim script.sh |
Now paste the following into the script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
apt-get update apt-get upgrade -y apt-get install apache2 mariadb-server libapache2-mod-php7.0 php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip install unzip sudo openssh-server -y /etc/init.d/ssh start wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.zip -O /tmp/nextcloud-13.0.2.zip cd /tmp/ unzip nextcloud-13.0.2.zip mv /tmp/nextcloud /var/www/html/ chown -R www-data:www-data /var/www/html/nextcloud/ rm -rf /tmp/nextcloud-13.0.2.zip /etc/init.d/apache2 start /etc/init.d/mysql start mysql -uroot -e "create database nextcloud;" mysql -uroot -e "GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'nextcloud';" cd /var/www/html/nextcloud/ sudo -u www-data php occ maintenance:install --database "mysql" --database-name "nextcloud" --database-user "nextcloud" --database-pass "nextcloud" --admin-user "admin" --admin-pass "password" |
Now adjust the permissions to make it executable.
1 |
chmod 700 script.sh |
Now lets copy it over to the container
1 |
docker cp script.sh id:/tmp/ |
Then jump on the console.
1 |
docker attach id# |
Once your connected in, execute the script, this will install setup everything.
1 |
/tmp/script.sh |
Once complete. Hit your web browser, navigate to https://localhost:10000/nextcloud. Should see the logon page, your credentials are Username: admin Password: password