Install Nextcloud 11.03 on Fedora 25 Minimal


  • Service Provider

    This Guide assumes that you are starting from Fedora 25 Minimal.

    Install Fedora 25 and then either log in as root, su to root, or prepend everything here with sudo. Your choice.

    #Update Fedora
    dnf update -y
    
    #install Nextcloud required and optional packages
    #wget is required because the Nexcloud guide says to use wget.
    #policycoreutils-python-utils is required to run semanage
    dnf install -y httpd mariadb mariadb-server php php-gd php-pdo php-pear php-mbstring php-xml php-pear-Net-Curl php-mcrypt php-intl php-ldap php-smbclient php-imap php-mysqli php-pear-MDB2 php-pear-MDB2-Driver-mysqli php-pecl-zip bzip2 policycoreutils-python-utils redis php-pecl-redis wget
    
    #Install nano because I do not want to use `vi`
    dnf install -y nano
    

    Install NextCloud 11.0.3. Update the wget and tar commands to reflect the current version at the time of your installation.

    #Create the root directory to extract nextcloud to
    mkdir -p /var/www/html/nextcloud
    
    #Get NextCloud
    wget https://download.nextcloud.com/server/releases/nextcloud-11.0.3.tar.bz2
    
    #Extract NextCloud
    tar xvf nextcloud-11.0.3.tar.bz2 -C /var/www/html
    

    Now we need to create the data directory. By default, Nextcloud will expect it to be within the main directory. If you move it, you will have to update a few things below to reference to correct folder path.

    Personally, if you are going to use a separate disk for the data, I would just mount it to /var/www/html/nextcloud/data

    So create the data directory

    #Create the data directory 
    mkdir -p /var/www/html/nextcloud/data
    

    Now grab a couple files to save time. The apache vhost file and a script to set secure directory permissions

    #get the nextcloud apache config file
    wget -O /etc/httpd/conf.d/nextcloud.conf https://raw.githubusercontent.com/sorvani/scripts/master/Nextcloud/nextcloud.conf
    #get a script to set secure folder permissions
    wget -O ~/secure_folders_rhel.sh https://raw.githubusercontent.com/sorvani/scripts/master/Nextcloud/secure_folders_rhel.sh
    #make the script executable
    chmod +x ~/secure_folders_rhel.sh
    #run the script
    ~/secure_folders_rhel.sh
    

    Open up the firewall to http traffic

    #open the firewall for http
    firewall-cmd --zone=public --add-port=http/tcp --permanent
    firewall-cmd --reload
    

    Start the database services

    
    #start the mariadb and set to start on boot
    systemctl start mariadb
    systemctl enable mariadb
    
    #start redis (used for memcache)
    systemctl start redis
    systemctl enable redis
    

    Create the Nextcloud database and then secure the mariadb install.

    Change ncuser, ncuserpassword, and somesecurepassword to something private.

    #Create a database for nextcloud and a user to access it.
    mysql -e "CREATE DATABASE nextcloud;"
    mysql -e "CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'ncuserpassword';"
    mysql -e "GRANT ALL ON nextcloud.* TO 'ncuser'@'localhost';"
    mysql -e "FLUSH PRIVILEGES;"
    
    #Secure mariadb. These commands do what mysql_secure_installation does interactively
    mysql -e "UPDATE mysql.user SET Password=PASSWORD('somesecurepassword') WHERE User='root';"
    mysql -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
    mysql -e "DELETE FROM mysql.user WHERE User='';"
    mysql -e "DROP DATABASE test;"
    mysql -e "FLUSH PRIVILEGES;"
    

    Configure SELinux permissions to allow email, network connections, and read/write permissions to the necessary folders.

    #download the script 
    wget -O ~/selinux_config.sh https://raw.githubusercontent.com/sorvani/scripts/master/Nextcloud/selinux_config.sh
    #set it to executable
    chmod +x ~/selinux_config.sh
    #execute the script
    ~/selinux_config.sh
    

    Start the webserver

    #Start Apache and enable for reboot.
    systemctl restart httpd
    systemctl enable httpd
    

    Creating a DNS entry is optional, but when the Nextcloud first run wizard happens in the browser, it sets the config.php to trust the URL in the browser. If you do not have DNS setup yet, you will have to go back and add this to your config.php later.

    #create a DNS entry for your server and go to it in your browser to complete the setup
    http://nextcloud.domain.com/nextcloud
    

    On the web GUI, enter your desired admin username and password.
    0_1489694134750_upload-6982fc23-f37f-40b8-8555-02ea1d6737be

    Then click the Storage & database dropdown.
    0_1489694170160_upload-db1dd473-e6ba-47d0-bed0-630e5efed8e7

    Leave the data folder alone unless you know that you changed it when going through the above instructions.
    0_1489694494762_upload-54c0e57e-4f3d-402d-a4d5-5f64d4a28bf0

    Change the database to MySQL/MariaDB
    0_1489694525338_upload-09b6afa0-19f8-4661-b8f8-30f3bfc05068

    Then fill it out with the information you used above.
    0_1489694596256_upload-c7100936-4fff-4a6f-a4c2-1968cc60ce35

    Click the Finish setup button
    0_1489694613615_upload-0e8c9b25-0269-40b1-8d03-b30523f06f01

    You will be automatically logged in and greeted with this.
    0_1489694685297_upload-cdf842b9-179e-4f3e-84e0-a93c3c64c5bb

    Go back to your SSH session and update the NextCloud config.php file to tell it to use redis for the memory cache and file locking.

    #add a line to nextcloud config.php to enable memory cache
    nano /var/www/html/nextcloud/config/config.php
    'memcache.locking' => '\OC\Memcache\Redis',
    'memcache.local' => '\OC\Memcache\Redis',
        'redis' => array(
        'host' => 'localhost',
        'port' => 6379,
    ),
    

    Restart the webserver

    systemctl restart httpd
    

    You now have a fully configured basic install.


  • Service Provider

    Follow post 2 of the Nextcloud 11 on CentOS 7 to pretty up the URL of your Fedora 25 install.

    But first you will have to take ownership of the .htaccess file back to the apache user.

    chown apache:apache /var/www/html/nextcloud/.htaccess
    

    When you are done with this step set it back to root manually or execute the secure_folders_rhel.sh again

    chown root:apache /var/www/html/nextcloud/.htaccess
    

  • Service Provider

    Follow post 3 of the Nextcloud 11 on CentOS 7 to enable SSL on your Fedora 25 install.



  • @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    If you follow my guide, I am not sure how you didn't. I did this all twice to make sure of my instructions.



  • @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?



  • @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    I copied the commands line by line from the post and pasted them into putty and hit enter after each line.


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    I copied the commands line by line from the post and pasted them into putty and hit enter after each line.

    It is in the download.
    0_1493930968458_upload-100c3d94-089e-4695-b039-107c05cffb75


  • Service Provider

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    single backtick for inline, not 3.
    0_1493931022333_upload-d905b893-45af-4100-9ba5-ce9624773524


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    I copied the commands line by line from the post and pasted them into putty and hit enter after each line.

    so ls -l /var/www/html/nextcloud



  • @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    ls -l /var/www/html/nextcloud

    0_1493931150599_Capture.PNG



  • @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    I copied the commands line by line from the post and pasted them into putty and hit enter after each line.

    Odd, that should extract to that directory.



  • @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    chown apache:apache /var/www/html/nextcloud/.htacess

    When I run that, I get chown: cannot access '/var/www/html/nextcloud/.htaccess': No such file or directory

    Hidden files don't copy with a cp -r. Did you by chance extract the nextcloud tar.gz file and then copy the files?

    single backtick for inline, not 3.
    0_1493931022333_upload-d905b893-45af-4100-9ba5-ce9624773524

    doh does it work? Dagnabit.



  • @wrx7m That should be ls -la /var/www/html/nextcloud Need that a option to show hidden files.



  • @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    ls -la /var/www/html/nextcloud

    0_1493931348461_Capture.PNG

    So it is there. When I go to the other post to change the urls, and ran - cd /var/www/html/nextcloud && sudo -u apache php occ maintenance:update:htaccess - I got Error updating .htaccess file, not enough permissions?


  • Service Provider

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m That should be ls -la /var/www/html/nextcloud Need that a option to show hidden files.

    yeah that...



  • Is it the same command to change ownership on a hidden file?


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @travisdh1 said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    ls -la /var/www/html/nextcloud

    0_1493931348461_Capture.PNG

    So it is there. When I go to the other post to change the urls, and ran - cd /var/www/html/nextcloud && sudo -u apache php occ maintenance:update:htaccess - I got Error updating .htaccess file, not enough permissions?

    That command requires the permissions to be apache:apache

    If you ran my script to set secure permissions your folder would look like this.

    So you should be to the point to chown it back.


  • Service Provider

    0_1493931901780_upload-70f5935e-ca8c-4f3d-ac66-0305d64b38e2


  • Service Provider

    @wrx7m Just tried. No issues.
    0_1493932062404_upload-4ed758e8-151e-4c35-81fd-c51875100916

    [[email protected] ~]# chown apache:apache /var/www/html/nextcloud/.htaccess 
    [[email protected] ~]# ls -la /var/www/html/nextcloud/.htaccess 
    -rw-r--r--. 1 apache apache 3793 Apr 28 21:54 /var/www/html/nextcloud/.htaccess
    [[email protected] ~]# chown root:apache /var/www/html/nextcloud/.htaccess 
    [[email protected] ~]# ls -la /var/www/html/nextcloud/.htaccess 
    -rw-r--r--. 1 root apache 3793 Apr 28 21:54 /var/www/html/nextcloud/.htaccess
    [[email protected] ~]# 
    


  • @JaredBusch Figured it out. Your commands had a typo and the file name is missing a "c". htacess
    0_1493932623889_Capture.PNG


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @JaredBusch Figured it out. Your commands had a typo and the file name is missing a "c". htacess
    0_1493932623889_Capture.PNG

    /sigh... Fixed.



  • @JaredBusch When you are looking at all this text, it can make your eyes bleed after awhile ;) I can't believe how many times I looked at it and started over. Well, at least I have learned several things I wouldn't have without that typo :)



  • Thanks @JaredBusch the step-by-step guide worked, I had no problems from start to finish.
    I'd like to go back & clean up the disk I used for the data portion of Nextcloud.



  • Have anyone noticed tar package is not installed when using Fedora 25 minimal?



  • Is there a reason you add the html directory to the nextcloud installation? All their docs show /var/www/nextcloud.


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    Is there a reason you add the html directory to the nextcloud installation? All their docs show /var/www/nextcloud.

    That's not where anything should be deployed. That's not the CentOS or the Fedora directory for that. It's not "wrong" to switch directories, but it is working against the OS which has a spot set up for it and expected already.



  • @scottalanmiller said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    Is there a reason you add the html directory to the nextcloud installation? All their docs show /var/www/nextcloud.

    That's not where anything should be deployed. That's not the CentOS or the Fedora directory for that. It's not "wrong" to switch directories, but it is working against the OS which has a spot set up for it and expected already.

    Sorry... Which one is not correct?


  • Service Provider

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @scottalanmiller said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    @wrx7m said in Install Nextcloud 11.03 on Fedora 25 Minimal:

    Is there a reason you add the html directory to the nextcloud installation? All their docs show /var/www/nextcloud.

    That's not where anything should be deployed. That's not the CentOS or the Fedora directory for that. It's not "wrong" to switch directories, but it is working against the OS which has a spot set up for it and expected already.

    Sorry... Which one is not correct?

    /var/www/html is the appropriate top level directory for web applications on the RH family of OSes. Jared's choice of location is what we would generally accept as correct. An application maker should not choose an alternative location to the standards for the OS in question.



  • @scottalanmiller - Thanks. That is exactly the answer I was looking for. I wonder why Nextcloud chose to do it at the root of www.

    Edit - Unless maybe it was developed for non-RH family flavors?



Looks like your connection to MangoLassi was lost, please wait while we try to reconnect.