GNU/Linux >> Tutoriales Linux >  >> Panels >> Panels

Script:Instale ownCloud en un Ubuntu 12.04 VPS

En una de nuestras publicaciones de blog anteriores, habíamos cubierto cómo instalar ownCloud en un VPS CentOS 6, hoy veremos cómo instalar ownCloud en un servidor Ubuntu 12.04 usando un script bash automatizado.

#!/bin/bash
#
# Install owncloud
# This script assumes you already have installed Apache & MySQL
#

# Change me
MYSQL_ROOT_PASSWD="YOUR MYSQL ROOT PASSWORD"

# Path to your localhost
www="/var/www"

# Apache User
wwwdata="www-data"

# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
   exit 1
fi

# Check arguments
if [ $# -ne 1 ]; then
    echo "Usage $0 domainName"
    exit 1
fi

# Create MySQL database
MYSQL_OC_PASSWD=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 8)
Q1="CREATE DATABASE IF NOT EXISTS owncloud;"
Q2="GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY '$MYSQL_OC_PASSWD';"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"
mysql -uroot -p$MYSQL_ROOT_PASSWD -e "$SQL" > /dev/null 2>&1

# Check if the database is created
if [ $? -ne 0 ]; then
    echo "Cannot connect to the MySQL database server"
    exit 1
fi

# Create the file with VirtualHost configuration
echo "<VirtualHost *:80>
        DocumentRoot $www/owncloud
        ServerName $1
        ServerAlias $1
        <Directory $www/owncloud>
                Options Indexes FollowSymLinks MultiViews +Includes
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>" > /etc/apache2/sites-available/$1

# Update System
apt-get -y update > /dev/null 2>&1

# Install PHP modules
apt-get -y install php5 php5-json php-xml php-mbstring php5-zip php5-gd php5-sqlite php5-mysql curl libcurl3 libcurl3-dev php5-curl php-pdo > /dev/null 2>&1

# Download and extract the latest version
wget -qO- -O tmp.tar.bz2 http://owncloud.org/releases/owncloud-latest.tar.bz2 && tar -C $www -xjf tmp.tar.bz2 && rm tmp.tar.bz2

# Set owner
chown $www-data: -R $www/owncloud

# Enable the site
a2ensite $1 > /dev/null 2>&1

# Reload Apache2
/etc/init.d/apache2 restart > /dev/null 2>&1

# Output
clear
echo "Open your web browser and navigate to your ownCloud instance"
echo "Url: $1"
echo "Database: owncloud"
echo "Database user: owncloud"
echo "Database user password: $MYSQL_OC_PASSWD"

¿Qué hará el guión?

  • Compruebe si el script se está ejecutando como root
  • Compruebe si el número de argumentos es correcto
  • Crear base de datos MySQL
  • Compruebe si la base de datos está creada
  • Cree el archivo con la configuración de VirtualHost
  • Instalar los módulos PHP necesarios
  • Descargue y extraiga la última versión de ownCloud
  • Establezca el propietario, habilite el sitio y reinicie Apache
  • Mostrar el nombre de la base de datos, el usuario y la contraseña

Guarde el script anterior como installOwncloud.sh (si aún no lo ha hecho), cambie "SU CONTRASEÑA DE RAÍZ DE MYSQL" con su contraseña de raíz de MySQL y luego escriba los siguientes comandos:

a+x installOwncloud.sh
./installOwncloud.sh  your.domainname.com

Finalmente, abra su navegador web y navegue hasta su instancia de ownCloud

Este script también debería funcionar en Debian.

PD. Si te gustó esta publicación, compártela con tus amigos en las redes sociales usando los botones de la izquierda o simplemente deja una respuesta a continuación. Gracias.


Panels
  1. Cómo instalar OwnCloud 7 en un Ubuntu 14.04 VPS

  2. Instale MDwiki en un Ubuntu 14.04 VPS

  3. Cómo instalar PrestaShop en un VPS Ubuntu 14.04

  4. Instale Fail2ban en un Ubuntu 14.04 VPS

  5. Instale WPScan en un Ubuntu 14.04 VPS

Cómo instalar OwnCloud en Ubuntu

Cómo instalar OwnCloud 8 en Ubuntu 14.04

Cómo instalar OwnCloud 8 en Ubuntu 15.04

Cómo instalar eGroupware en un Ubuntu 14.04 VPS

Instale VTEDDY en un Ubuntu 14.04 VPS

Cómo instalar OwnCloud en Ubuntu 20.04