参考官方文档
一、准备
Ubuntu 20.04虚拟机一个 常用配置4C8G100HD
二、替换apt源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bat
root@owncloud-dev:/home/htuser
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
三、部署
sudo apt update
sudo apt upgrade
FILE="/usr/local/bin/occ"
cat <<EOM >$FILE
cd /var/www/owncloud
sudo -E -u www-data /usr/bin/php /var/www/owncloud/occ "\$@"
EOM
chmod +x $FILE
apt install -y apache2 libapache2-mod-php mariadb-server openssl redis-server wget php-imagick php-common php-curl php-gd php-imap php-intl php-json php-mbstring php-mysql php-ssh2 php-xml php-zip php-apcu php-redis php-ldap php-opcache
apt-get install -y libsmbclient-dev php-dev php-pear
pecl install smbclient-stable
echo "extension=smbclient.so" > /etc/php/7.4/mods-available/smbclient.ini
phpenmod smbclient
systemctl restart apache2
apt install -y unzip bzip2 rsync curl jq inetutils-ping ldap-utils smbclient
FILE="/etc/apache2/sites-available/owncloud.conf"
cat <<EOM >$FILE
<VirtualHost *:80>
DirectoryIndex index.php index.html
DocumentRoot /var/www/owncloud
<Directory /var/www/owncloud>
Options +FollowSymlinks -Indexes
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
</VirtualHost>
EOM
a2dissite 000-default
a2ensite owncloud.conf
systemctl reload apache2
systemctl start mariadb
echo "Enabling Apache Modules"
a2enmod dir env headers mime rewrite setenvif
service apache2 reload
wget https://download.owncloud.org/community/owncloud-complete-latest.tar.bz2 && tar -xjf owncloud-complete-latest.tar.bz2 && chown -R www-data. owncloud
occ maintenance:install --database "mysql" --database-name "owncloud" --database-user "owncloud" --database-pass "ht00@pass" --data-dir "/var/www/owncloud/data" --admin-user "admin" --admin-pass "admin"
myip=$(hostname -I|cut -f1 -d ' ')
occ config:system:set trusted_domains 1 --value="$myip"
occ background:cron
echo "*/15 * * * * /var/www/owncloud/occ system:cron" | sudo -u www-data -g crontab tee -a /var/spool/cron/crontabs/www-data
echo "*/15 * * * * /var/www/owncloud/occ user:sync \
'OCA\User_LDAP\User_Proxy' -m disable -vvv >> \
/var/log/ldap-sync/user-sync.log 2>&1" | sudo -u www-data -g crontab tee -a /var/spool/cron/crontabs/www-data
mkdir -p /var/log/ldap-sync
touch /var/log/ldap-sync/user-sync.log
chown www-data. /var/log/ldap-sync/user-sync.log
occ config:system:set memcache.local --value '\OC\Memcache\APCu'
occ config:system:set memcache.locking --value '\OC\Memcache\Redis'
occ config:system:set redis --value '{"host": "127.0.0.1", "port": "6379"}' --type json
FILE="/etc/logrotate.d/owncloud"
sudo cat <<EOM >$FILE
/var/www/owncloud/data/owncloud.log {
size 10M
rotate 12
copytruncate
missingok
compress
compresscmd /bin/gzip
}
EOM
cd /var/www/
chown -R www-data. owncloud
occ -V
登录:ip 账号:admin 密码:admin
|