$ sudo apt update
$ sudo apt install apache2
$ sudo systemctl start apache2.service
$ sudo systemctl enable apache2.service
설치 확인 :: 80번 포트 수정 방안 필요
## curl or IP:80 브라우저 접속
$ curl localhost:80
포트 번호 변경
## Listen 80이라고 설정된 포트를 원하는 포트로 변경
$ sudo vi /etc/apache2/ports.conf
$ sudo systemctl restart apache2.service
$ sudo apt-get install mariadb-server mariadb-client
$ sudo systemctl start mariadb.service
$ sudo systemctl enable mariadb.service
$ sudo mysql -u root -p
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php :: enter 입력
$ sudo apt update
$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip
설치한 mysql에 접속
$ sudo mysql -u root -p
nextcloud에 사용될 DB구성 설정
CREATE DATABASE DB명;
CREATE USER '유저명'@'localhost' IDENTIFIED BY '비밀번호';
## 계정에 권한 설정
GRANT ALL ON DB명.* TO '유저명'@'localhost' IDENTIFIED BY '비밀번호' WITH GRANT OPTION;
FLUSH PRIVILEGES;
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
$ cd /var/www/html
$ sudo git clone --branch stable21 https://github.com/nextcloud/server.git nextcloud
$ cd /var/www/html/nextcloud
$ sudo composer install
$ sudo git submodule update --init
$ sudo chown -R www-data:www-data /var/www/html/nextcloud/
$ sudo chmod -R 755 /var/www/html/nextcloud/
/etc/apache2/sites-available
$ sudo vi /etc/apache2/sites-available/nextcloud.conf
<VirtualHost *:80> ## 3.1에서 변경한 port로 수정 필요
ServerAdmin 이메일주소 ## 수정 필요
DocumentRoot /var/www/html/nextcloud/
ServerName 서버 아이피 또는 URL ## 수정 필요
Alias /nextcloud "/var/www/html/nextcloud/"
<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
모듈 활성화
$ sudo a2ensite nextcloud.conf
$ sudo a2enmod rewrite
$ sudo a2enmod headers
$ sudo a2enmod env
$ sudo a2enmod dir
$ sudo a2enmod mime
$ sudo systemctl restart apache2.service