Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#SSH to your instance
#example :
#chmod 600 YOURPEMKEY.pem
#ssh -i YOURPEMKEY.pem ec2-user@YOURELASTICIP
#update current packages
sudo yum update -y
#install prerequisites
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum –enablerepo=webtatic
sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
sudo yum install -y httpd mariadb-server
sudo yum remove -y php*
sudo yum install -y php72w php72w-gd php72w-json php72w-pdo php72w-curl php72w-intl php72w-mcrypt php72w-zip php72w-xml php72w-mbstring php72w-mysqlnd
#Install Owncloud
sudo yum –enablerepo=epel install php-pear-Net-Curl php-pear-MDB2-Driver-mysqli
cd /etc/yum.repos.d/
sudo rpm --import https://download.owncloud.org/download/repositories/production/CentOS_7/repodata/repomd.xml.key
sudo wget http://download.owncloud.org/download/repositories/production/CentOS_7/ce:stable.repo
sudo yum -y install owncloud-files
sudo chown -R apache.apache /var/www/html/owncloud/
#Start and enable httpd and mariadb
sudo systemctl start httpd
sudo systemctl start mariadb
sudo systemctl enable httpd
sudo systemctl enable mariadb
sudo mysql_secure_installation
#configure Owncloud db
mysql -u root -p
# Press enter when they ask you for password
MariaDB [(none)]> create database clouddb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on clouddb.* to 'clouddbuser'@'localhost' identified by 'YOUR_PASSWORD';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>exit
#Setup second disk to be able to receive owncloud files
[root@ip-YOUR_ELASTIC_IP ] lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdb 202:16 0 500G 0 disk
#Mount the disk, more detail here :https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
#So here we see that my disk is name xvdb
#Let's mount it
sudo file -s /dev/xvdb
sudo mkfs -t ext4 /dev/xvdb
sudo mkdir /owncloudDisk
sudo mount /dev/xvdb /owncloudDisk
sudo cp /etc/fstab /etc/fstab.orig
sudo file -s /dev/xvdb
sudo vim /etc/fstab
# Add a line with your UID example : UUID=YOURUID /owncloudDisk ext4 quiet,defaults,permissions,locale=en_US.utf8 0 2
sudo mount -a
sudo chmod 0770 /owncloudDisk/
sudo chown -R apache:apache /owncloudDisk
sudo service httpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.