Ubuntu 配置NextCloud

安装常用软件:

1: SSH    sudo apt-get install openssh-server

    ssh启用root登陆:vi /etc/ssh/sshd_config  注释掉#PermitRootLogin prohibit-password   下面添加PermitRootLogin yes      

2: 默认启动界面更改: sudo systemctl set-difault multi-user.target  /   graphical.target

3:启用root用户 sudo passwd -u root

4: vim      sudo apt-get instal vim

安装Apache

    sudo apt-get install apache2

安装Mysql

    sudo apt-get install mysql-server mysql-client

    测试:mysql -uroot -p    查看状态:service mysql status

    创建nextcloud数据库: create database nextcloud set utf8;

安装PHP模块

    sudo apt-get install libapache2-mod-php

    sudo apt-get install php-mysql    

    sudo apt install -y 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

    重启服务:service apache2 restart    service mysql restart

    测试Apache能否解析PHP:

            vim /var/www/html/phpinfo.php

            文件中写:

            浏览器访问:http://ubuntu地址/phpinfo.php,出现PHP

修改权限    sudo chmod 777 /var/www

安装phpMyAdmin    sudo apt-get install phpmyadmin

        创建phpmyadmin快捷:ln -s /usr/share/phpmyadmin /var/www/html

        启用Apache mo_rewrite模块: a2enmod rewrite

        重启服务: service php7.0-fpm restart    service apache2 restart

        测试,浏览器访问: http://ip/phpmyadmin

安装NextCloud

    cd /var/www/html

    wget https://download.nextcloud.com/server/releases/nextcloud-13.0.3.zip

    unzip nextcloud-13.0.3.zip

    设置 nextcloud 的目录权限:sudo chown -R www-data:www-data /var/www/html/nextcloud/

    浏览器上输入http://服务器IP/nextcloud后就会出现next cloud配置界面了。

Nextcloud OCC命令行工具

shijiaofa-test:/var/www/html/nextcloud #sudo -u www-data php occ -v

若出现上图权限问题 ,设置 nextcloud 的目录权限:sudo chown -R www-data:www-data /var/www/html/nextcloud/