Installing OwnCloud 9 on CentOS 7 with REMI\EPEL, PHP 5.6, Apache 2.4, MariaDB and SSL
-
Here is the script I am working on:
#!/bin/bash
#OwnCloud 9 Install on CentOS7
echo "MySQL Root Password?"
read mysqlroot
echo "Database Name?"
read ownclouddb
echo "Database User?"
read ownclouduser
echo "Database User Password?"
read ownclouduserpassword
echo "Domain Name?"
read domainname
echo Running Updates..
yum -y update
echo Installing and Setting Up REMI Repository...
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm
sed -i '9s/./enabled=1/' /etc/yum.repos.d/remi.repo
sed -i '27s/./enabled=1/' /etc/yum.repos.d/remi.repo
rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key
wget http://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -O /etc/yum.repos.d/ce:stable.repo
echo Installing Needed Packages...
yum -y install wget mariadb-server php php-mysql httpd epel-release wget
setenforce permissive
mkdir /data
yum clean expire-cache
yum -y install owncloud
systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb
chown -R apache:apache /var/www/html/owncloud
chown -R apache:apache /data
firewall-cmd --zone=public --add-port=http/tcp --permanent
firewall-cmd --zone=public --add-port=https/tcp --permanent
firewall-cmd --reload
echo Securing MySQL...
#Make sure that NOBODY can access the server without a password
mysql -e "UPDATE mysql.user SET Password = PASSWORD('$mysqlroot') WHERE User = 'root'"
#Kill the anonymous users
mysql -e "DROP USER ''@'localhost'"
#Because our hostname varies we'll use some Bash magic here.
mysql -e "DROP USER ''@'$(hostname)'"
#Kill off the demo database
mysql -e "DROP DATABASE test"
#Make our changes take effect
mysql -e "FLUSH PRIVILEGES"
#Any subsequent tries to run queries this way will get access denied because lack of usr/pwd param
echo Setting Up MySQL#!/bin/bash
echo -n "Enter the MySQL root password: "
read -s rootpw
echo -n "Enter database name: "
read dbname
echo -n "Enter database username: "
read dbuser
echo -n "Enter database user password: "
read dbpwdb="create database $dbname;GRANT ALL PRIVILEGES ON $dbname.* TO $dbuser@localhost IDENTIFIED BY '$dbpw';FLUSH PRIVILEGES;"
mysql -u root -p$rootpw -e "$db"if [ $? != "0" ]; then
echo "[Error]: Database creation failed"
exit 1
else
echo "------------------------------------------"
echo " Database has been created successfully "
echo "------------------------------------------"
echo " DB Info: "
echo ""
echo " DB Name: $dbname"
echo " DB User: $dbuser"
echo " DB Pass: $dbpw"
echo ""
echo "------------------------------------------"
fi -
It almost all works. Any suggestions welcome
The SQL isn't working yet.....
-
What database error are you getting?
-
@scottalanmiller No errors.
The commands to secure MySQL and create the database with proper permissions don't work right yet. The last 17 lines.
-
Do I need to encapsulate the variables in quotes?
-
@aaronstuder said:
Do I need to encapsulate the variables in quotes?
I think that the command needs to be in quotes. I don't script MySQL commands that way often so am not familiar with the syntax. I use SQL inside MySQL regularly, but not this way. But that looks like a case where quotes would be needed.
-
I take it back, it seems the securing MySQL part works fine.....
The problem is here:
echo Setting Up MySQL mysql -u root -p $mysqlroot -e create database $ownclouddb; mysql -u root -p $mysqlroot -e create user '$ownclouduser'@'localhost' identified by '$ownclouduserpassword'; mysql -u root -p $mysqlroot -e grant all on $ownclouddb.* to '$ownclouduser'@'localhost'; mysql -u root -p $mysqlroot -e flush privileges;
-
So you mean:
mysql -u root -p $mysqlroot -e create database $ownclouddb;
Becomes:
mysql -u root -p $mysqlroot -e "create database $ownclouddb;"
?
-
@aaronstuder Correct
-
Hi,
I would like to thank you for your guide. It works great. Can you provide additional information e.g how to upload a big file, or how to upload a lot of file maybe 2000 files, 3000 files at once?
Thanks -
@dsc81 said:
Hi,
I would like to thank you for your guide. It works great. Can you provide additional information e.g how to upload a big file, or how to upload a lot of file maybe 2000 files, 3000 files at once?
ThanksWhat kind of info do you want about that? The sync tool will handle that for you. There isn't any magic answer, a large upload will take quite some time.
-
@scottalanmiller
What I mean is I only can upload one file at a time, I heard that we can setting so we can upload many file at once and also the limit is only 2mb, can we upload file 5GB? -
@dsc81 said:
@scottalanmiller
What I mean is I only can upload one file at a time, I heard that we can setting so we can upload many file at once and also the limit is only 2mb, can we upload file 5GB?You need to configure your system to fix the PHP issue restricting filesize.
You have multiple options for connectivity. if you are using the web browser, the basic setup is single file uplaods.