Panduan lengkap instalasi OwnCloud di Ubuntu 22.04, memastikan penyimpanan data aman dan mudah diakses. Tingkatkan produktivitas dengan langkah-langkah instalasi yang sederhana dan efektif.
Menambahkan repository php 7.4
sudo add-apt-repository ppa:ondrej/php -y
Contoh hasil output :
root@cloud-dev:~# add-apt-repository ppa:ondrej/php -y Hit:1 http://id.archive.ubuntu.com/ubuntu focal InRelease Get:2 http://id.archive.ubuntu.com/ubuntu focal-updates InRelease [128 kB] Hit:3 http://id.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:4 http://id.archive.ubuntu.com/ubuntu focal-security InRelease Get:5 http://id.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [3,426 kB] Get:6 http://id.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,210 kB] Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [24.6 kB] Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [128 kB] Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main Translation-en [41.2 kB] Fetched 4,958 kB in 2s (2,193 kB/s) Reading package lists... Done root@cloud-dev:~#
Mengupdate repository dan mengupgrade package
sudo apt update && sudo apt upgrade
Contoh hasil output :
root@cloud-dev:~# apt update && apt upgrade Hit:1 http://id.archive.ubuntu.com/ubuntu focal InRelease Hit:2 http://id.archive.ubuntu.com/ubuntu focal-updates InRelease Hit:3 http://id.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:4 http://id.archive.ubuntu.com/ubuntu focal-security InRelease Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease Reading package lists... Done Building dependency tree Reading state information... Done 110 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: libfwupdplugin1 libxmlb1 Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: distro-info libatasmart4 libblockdev-crypto2 libblockdev-fs2 libblockdev-loop2 libblockdev-part-err2 libblockdev-part2 libblockdev-swap2 libblockdev-utils2 libblockdev2 libfwupdplugin5 libjcat1 libmbim-glib4 libmbim-proxy libmm-glib0 libnspr4 libnss3 libparted-fs-resize0 libqmi-glib5 libqmi-proxy libudisks2-0 libvolume-key1 libxmlb2 modemmanager motd-news-config ubuntu-pro-client ubuntu-pro-client-l10n udisks2 usb-modeswitch usb-modeswitch-data The following packages will be upgraded: alsa-ucm-conf apparmor apport apt apt-utils base-files bcache-tools bolt cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf command-not-found finalrd friendly-recovery fwupd fwupd-signed gir1.2-glib-2.0 initramfs-tools initramfs-tools-bin initramfs-tools-core iptables iputils-ping iputils-tracepath isc-dhcp-client isc-dhcp-common kmod kpartx landscape-common language-selector-common libapparmor1 libapt-pkg6.0 libargon2-1 libasound2 libasound2-data libdns-export1109 libefiboot1 libefivar1 libfwupd2 libfwupdplugin1 libgirepository-1.0-1 libgpgme11 libidn2-0 libip4tc2 libip6tc2 libisc-export1105 libkeyutils1 libkmod2 libnss-systemd libpam-systemd libparted2 libpci3 libpcre2-8-0 libpcre3 libplymouth5 libsystemd0 libudev1 libunwind8 libxml2 libxmlb1 libxtables12 libzstd1 linux-base lshw lsof ltrace mdadm multipath-tools overlayroot parted pciutils plymouth plymouth-theme-ubuntu-text pollinate python-apt-common python3-apport python3-apt python3-commandnotfound python3-debian python3-distro-info python3-distupgrade python3-problem-report python3-software-properties python3-update-manager rsync sbsigntool snapd software-properties-common sosreport strace systemd systemd-sysv systemd-timesyncd tcpdump tzdata ubuntu-advantage-tools ubuntu-keyring ubuntu-minimal ubuntu-release-upgrader-core ubuntu-server ubuntu-standard udev ufw unattended-upgrades update-manager-core update-notifier-common vim vim-common vim-runtime vim-tiny xxd 110 upgraded, 30 newly installed, 0 to remove and 0 not upgraded. Need to get 59.3 MB of archives. After this operation, 45.6 MB disk space will be freed. Do you want to continue? [Y/n] Y ... ... Processing triggers for mime-support (3.64ubuntu1) ... Processing triggers for libc-bin (2.31-0ubuntu9.16) ... Processing triggers for rsyslog (8.2001.0-1ubuntu1.3) ... invoke-rc.d: policy-rc.d denied execution of try-restart. Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.4.0-189-generic Setting up ubuntu-server (1.450.2) ... root@cloud-dev:~#
Menginstall package image magick
sudo apt install imagemagick
Rekomendasi package
sudo apt install -y unzip bzip2 rsync curl jq inetutils-ping
Menginstall php 7.4
sudo apt install php7.4 php7.4-intl php7.4-mysql php7.4-mbstring \ php7.4-imagick php7.4-igbinary php7.4-gmp php7.4-bcmath \ php7.4-curl php7.4-gd php7.4-zip php7.4-imap php7.4-ldap \ php7.4-bz2 php7.4-ssh2 php7.4-common php7.4-json \ php7.4-xml php7.4-dev php7.4-apcu php7.4-redis \ libsmbclient-dev php-pear php-phpseclib -y
Contoh hasil output :
root@cloud-dev:~# apt install php7.4 php7.4-intl php7.4-mysql php7.4-mbstring \ > php7.4-imagick php7.4-igbinary php7.4-gmp php7.4-bcmath \ > php7.4-curl php7.4-gd php7.4-zip php7.4-imap php7.4-ldap \ > php7.4-bz2 php7.4-ssh2 php7.4-common php7.4-json \ > php7.4-xml php7.4-dev php7.4-apcu php7.4-redis \ > libsmbclient-dev php-pear php-phpseclib Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libfwupdplugin1 libxmlb1 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: apache2 apache2-bin apache2-data apache2-utils autoconf automake autopoint autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 debhelper dh-autoreconf dh-strip-nondeterminism dpkg-dev dwz fakeroot fontconfig-config fonts-dejavu-core fonts-droid-fallback fonts-noto-mono fonts-urw-base35 g++ g++-9 gcc gcc-9 gcc-9-base gettext ghostscript gsfonts imagemagick-6-common intltool-debian libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive-cpio-perl libarchive-zip-perl libasan5 libatomic1 libavahi-client3 libavahi-common-data libavahi-common3 libbinutils libc-client2007e libc-dev-bin libc6-dev libcc1-0 libcroco3 libcrypt-dev libctf-nobfd0 libctf0 libcups2 libdebhelper-perl libdpkg-perl libfakeroot libfftw3-double3 libfile-fcntllock-perl libfile-stripnondeterminism-perl libfontconfig1 libgcc-9-dev libgd3 libgomp1 libgraphite2-3 libgs9 libgs9-common libharfbuzz0b libidn11 libijs-0.35 libimagequant0 libisl22 libitm1 libjansson4 libjbig0 libjbig2dec0 libjpeg-turbo8 libjpeg8 liblcms2-2 libldb2 liblqr-1-0 liblsan0 libltdl-dev liblua5.2-0 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmail-sendmail-perl libmpc3 libonig5 libopenjp2-7 libpaper-utils libpaper1 libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 libquadmath0 libraqm0 libsmbclient libssh2-1 libssl-dev libstdc++-9-dev libsub-override-perl libsys-hostname-long-perl libtalloc2 libtevent0 libtiff5 libtool libtsan0 libubsan1 libwbclient0 libwebp6 libwebpmux3 libxpm4 libzip4 linux-libc-dev m4 make manpages-dev mlock php-cli php-common php7.4-cli php7.4-opcache php7.4-readline php8.3-cli php8.3-common php8.3-opcache php8.3-readline pkg-config pkg-php-tools po-debconf poppler-data python3-ldb python3-talloc samba-libs shtool ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser autoconf-archive gnu-standards autoconf-doc binutils-doc cpp-doc gcc-9-locales dh-make debian-keyring fonts-noto fonts-freefont-otf | fonts-freefont-ttf fonts-texgyre g++-multilib g++-9-multilib gcc-9-doc gcc-multilib flex bison gdb gcc-doc gcc-9-multilib gettext-doc libasprintf-dev libgettextpo-dev ghostscript-x uw-mailutils glibc-doc cups-common bzr libfftw3-bin libfftw3-dev libgd-tools liblcms2-utils libtool-doc libmagickcore-6.q16-6-extra libssl-doc libstdc++-9-doc gfortran | fortran95-compiler gcj-jdk m4-doc make-doc php-libsodium php-mcrypt dh-php redis-server libmail-box-perl poppler-utils fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils autoconf automake autopoint autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-9 debhelper dh-autoreconf dh-strip-nondeterminism dpkg-dev dwz fakeroot fontconfig-config fonts-dejavu-core fonts-droid-fallback fonts-noto-mono fonts-urw-base35 g++ g++-9 gcc gcc-9 gcc-9-base gettext ghostscript gsfonts imagemagick-6-common intltool-debian libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libarchive-cpio-perl libarchive-zip-perl libasan5 libatomic1 libavahi-client3 libavahi-common-data libavahi-common3 libbinutils libc-client2007e libc-dev-bin libc6-dev libcc1-0 libcroco3 libcrypt-dev libctf-nobfd0 libctf0 libcups2 libdebhelper-perl libdpkg-perl libfakeroot libfftw3-double3 libfile-fcntllock-perl libfile-stripnondeterminism-perl libfontconfig1 libgcc-9-dev libgd3 libgomp1 libgraphite2-3 libgs9 libgs9-common libharfbuzz0b libidn11 libijs-0.35 libimagequant0 libisl22 libitm1 libjansson4 libjbig0 libjbig2dec0 libjpeg-turbo8 libjpeg8 liblcms2-2 libldb2 liblqr-1-0 liblsan0 libltdl-dev liblua5.2-0 libmagickcore-6.q16-6 libmagickwand-6.q16-6 libmail-sendmail-perl libmpc3 libonig5 libopenjp2-7 libpaper-utils libpaper1 libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix3 libquadmath0 libraqm0 libsmbclient libsmbclient-dev libssh2-1 libssl-dev libstdc++-9-dev libsub-override-perl libsys-hostname-long-perl libtalloc2 libtevent0 libtiff5 libtool libtsan0 libubsan1 libwbclient0 libwebp6 libwebpmux3 libxpm4 libzip4 linux-libc-dev m4 make manpages-dev mlock php-cli php-common php-pear php-phpseclib php7.4 php7.4-apcu php7.4-bcmath php7.4-bz2 php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-gd php7.4-gmp php7.4-igbinary php7.4-imagick php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-redis php7.4-ssh2 php7.4-xml php7.4-zip php8.3-cli php8.3-common php8.3-opcache php8.3-readline pkg-config pkg-php-tools po-debconf poppler-data python3-ldb python3-talloc samba-libs shtool ssl-cert 0 upgraded, 168 newly installed, 0 to remove and 0 not upgraded. Need to get 92.0 MB of archives. After this operation, 393 MB of additional disk space will be used. Do you want to continue? [Y/n] Y .... .... Processing triggers for man-db (2.9.1-1) ... Processing triggers for install-info (6.7.0.dfsg.2-5) ... Processing triggers for php7.4-cli (1:7.4.33-13+ubuntu20.04.1+deb.sury.org+1) ... Processing triggers for php8.3-cli (8.3.9-1+ubuntu20.04.1+deb.sury.org+1) ... Processing triggers for libapache2-mod-php7.4 (1:7.4.33-13+ubuntu20.04.1+deb.sury.org+1) ... root@cloud-dev:~#
Check versi php, jika ada 2 seperti ini, perlu di select default ke 7.4
root@cloud-dev:~# php -v PHP 8.3.9 (cli) (built: Jul 5 2024 12:03:23) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.9, Copyright (c) Zend Technologies with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies root@cloud-dev:~# root@cloud-dev:~# php7.4 -v PHP 7.4.33 (cli) (built: Jun 6 2024 16:48:09) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies root@cloud-dev:~# root@cloud-dev:~#
Menjalankan perintah untuk update alternative php
sudo update-alternatives --set php /usr/bin/php7.4 sudo update-alternatives --set phar /usr/bin/phar7.4 sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.4 sudo update-alternatives --set phpize /usr/bin/phpize7.4 sudo update-alternatives --set php-config /usr/bin/php-config7.4
Contoh hasil output
root@cloud-dev:~# update-alternatives --set php /usr/bin/php7.4 update-alternatives: using /usr/bin/php7.4 to provide /usr/bin/php (php) in manual mode root@cloud-dev:~# update-alternatives --set phar /usr/bin/phar7.4 update-alternatives: using /usr/bin/phar7.4 to provide /usr/bin/phar (phar) in manual mode root@cloud-dev:~# update-alternatives --set phar.phar /usr/bin/phar.phar7.4 update-alternatives: using /usr/bin/phar.phar7.4 to provide /usr/bin/phar.phar (phar.phar) in manual mode root@cloud-dev:~# update-alternatives --set phpize /usr/bin/phpize7.4 root@cloud-dev:~#
Mendownload owncloud
root@cloud-dev:~# wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2 --2024-07-17 23:27:30-- https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2 Resolving download.owncloud.com (download.owncloud.com)... 167.233.14.167, 2a01:4f8:1c1d:3d1::1 Connecting to download.owncloud.com (download.owncloud.com)|167.233.14.167|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 76010860 (72M) [application/x-bzip2] Saving to: 'owncloud-complete-latest.tar.bz2' owncloud-complete-latest.tar.bz2 100%[===============================================================================================================>] 72.49M 3.53MB/s in 21s 2024-07-17 23:27:52 (3.38 MB/s) - 'owncloud-complete-latest.tar.bz2' saved [76010860/76010860] root@cloud-dev:~#
Menfalidasi integritas file yang kita download
root@cloud-dev:~# wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2.sha256 --2024-07-17 23:28:14-- https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2.sha256 Resolving download.owncloud.com (download.owncloud.com)... 167.233.14.167, 2a01:4f8:1c1d:3d1::1 Connecting to download.owncloud.com (download.owncloud.com)|167.233.14.167|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 99 [text/plain] Saving to: 'owncloud-complete-latest.tar.bz2.sha256' owncloud-complete-latest.tar.bz2.sha256 100%[===============================================================================================================>] 99 --.-KB/s in 0s 2024-07-17 23:28:15 (18.0 MB/s) - 'owncloud-complete-latest.tar.bz2.sha256' saved [99/99] root@cloud-dev:~# root@cloud-dev:~# sha256sum -c owncloud-complete-latest.tar.bz2.sha256 < owncloud-complete-latest.tar.bz2 owncloud-complete-latest.tar.bz2: OK root@cloud-dev:~#
Mengextrack file installaer owncloud ke dalam folder /var/www/html
root@cloud-dev:~# tar -xjf owncloud-complete-latest.tar.bz2 -C /var/www/html/ root@cloud-dev:~# root@cloud-dev:~# ls -aslh /var/www/html/ total 24K 4.0K drwxr-xr-x 3 root root 4.0K Jul 17 23:29 . 4.0K drwxr-xr-x 3 root root 4.0K Jul 17 23:24 .. 12K -rw-r--r-- 1 root root 11K Jul 17 14:30 index.html 4.0K drwxr-xr-x 12 nobody nogroup 4.0K Feb 26 17:52 owncloud root@cloud-dev:~# root@cloud-dev:~# chown -R www-data:www-data /var/www/html/owncloud/ root@cloud-dev:~# root@cloud-dev:~# chmod -R 755 /var/www/html/owncloud/ root@cloud-dev:~# root@cloud-dev:~# ls -aslh /var/www/html/ total 24K 4.0K drwxr-xr-x 3 root root 4.0K Jul 17 23:29 . 4.0K drwxr-xr-x 3 root root 4.0K Jul 17 23:24 .. 12K -rw-r--r-- 1 root root 11K Jul 17 14:30 index.html 4.0K drwxr-xr-x 12 www-data www-data 4.0K Feb 26 17:52 owncloud root@cloud-dev:~#
Membuat file konfigurasi untuk owncloud di webserver apache2
root@cloud-dev:~# nano /etc/apache2/sites-available/owncloud.conf root@cloud-dev:~# root@cloud-dev:~# a2ensite owncloud.conf Enabling site owncloud. To activate the new configuration, you need to run: systemctl reload apache2 root@cloud-dev:~# root@cloud-dev:~# systemctl reload apache2 root@cloud-dev:~# root@cloud-dev:~# ls -l /var/www/html/owncloud total 688 drwxr-xr-x 58 www-data www-data 4096 Feb 26 17:52 apps -rwxr-xr-x 1 www-data www-data 8859 Feb 26 17:52 AUTHORS -rwxr-xr-x 1 www-data www-data 529931 Feb 26 17:52 CHANGELOG.md drwxr-xr-x 2 www-data www-data 4096 Feb 26 17:52 config -rwxr-xr-x 1 www-data www-data 3678 Feb 26 17:52 console.php -rwxr-xr-x 1 www-data www-data 34520 Feb 26 17:52 COPYING drwxr-xr-x 16 www-data www-data 4096 Feb 26 17:53 core -rwxr-xr-x 1 www-data www-data 1717 Feb 26 17:52 cron.php -rwxr-xr-x 1 www-data www-data 31204 Feb 26 17:52 db_structure.xml -rwxr-xr-x 1 www-data www-data 179 Feb 26 17:52 index.html -rwxr-xr-x 1 www-data www-data 2607 Feb 26 17:52 index.php drwxr-xr-x 6 www-data www-data 4096 Feb 26 17:52 lib -rwxr-xr-x 1 www-data www-data 283 Feb 26 17:52 occ drwxr-xr-x 2 www-data www-data 4096 Feb 26 17:52 ocm-provider drwxr-xr-x 2 www-data www-data 4096 Feb 26 17:52 ocs drwxr-xr-x 2 www-data www-data 4096 Feb 26 17:52 ocs-provider -rwxr-xr-x 1 www-data www-data 3135 Feb 26 17:52 public.php -rwxr-xr-x 1 www-data www-data 3816 Feb 26 17:52 README.md -rwxr-xr-x 1 www-data www-data 5624 Feb 26 17:52 remote.php drwxr-xr-x 4 www-data www-data 4096 Feb 26 17:52 resources -rwxr-xr-x 1 www-data www-data 26 Feb 26 17:52 robots.txt drwxr-xr-x 12 www-data www-data 4096 Feb 26 17:52 settings -rwxr-xr-x 1 www-data www-data 2231 Feb 26 17:52 status.php drwxr-xr-x 6 www-data www-data 4096 Jul 13 2023 updater -rwxr-xr-x 1 www-data www-data 282 Feb 26 17:52 version.php root@cloud-dev:~#
Isi config apache owncloud.conf
root@cloud-dev:~# cat /etc/apache2/sites-available/owncloud.conf <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/owncloud/ ServerName example.com ServerAlias www.example.com ServerAlias 10.20.30.221 <Directory /var/www/html/owncloud/> Options +FollowSymlinks AllowOverride All Require all granted <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/html/owncloud SetEnv HTTP_HOME /var/www/html/owncloud </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> root@cloud-dev:~#
Mengenable beberapa module pendukung
root@cloud-one:~# a2enmod rewrite env dir mime unique_id headers ssl Enabling module rewrite. Module env already enabled Module dir already enabled Module mime already enabled Module unique_id already enabled Module headers already enabled Considering dependency setenvif for ssl: Module setenvif already enabled Considering dependency mime for ssl: Module mime already enabled Considering dependency socache_shmcb for ssl: Enabling module socache_shmcb. Enabling module ssl. See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates. To activate the new configuration, you need to run: systemctl restart apache2 root@cloud-one:~#
Merestart web server apache
sudo systemctl restart apache2
root@cloud-one:~# systemctl restart apache2
Menginstall server mariadb
sudo apt install mariadb-server
root@cloud-one:~# apt install mariadb-server Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: libflashrom1 libftdi1-2 Use 'apt autoremove' to remove them. The following additional packages will be installed: galera-4 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient21 libsnappy1v5 libtimedate-perl liburi-perl liburing2 mariadb-client-10.6 mariadb-client-core-10.6 mariadb-common mariadb-server-10.6 mariadb-server-core-10.6 mysql-common socat Suggested packages: libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libbusiness-isbn-perl libwww-perl mailx mariadb-test The following NEW packages will be installed: galera-4 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl liblwp-mediatypes-perl libmariadb3 libmysqlclient21 libsnappy1v5 libtimedate-perl liburi-perl liburing2 mariadb-client-10.6 mariadb-client-core-10.6 mariadb-common mariadb-server mariadb-server-10.6 mariadb-server-core-10.6 mysql-common socat 0 upgraded, 32 newly installed, 0 to remove and 2 not upgraded. Need to get 18.6 MB of archives. After this operation, 164 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 mysql-common all 5.8+1.0.8 [7,212 B] Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-common all 1:10.6.18-0ubuntu0.22.04.1 [16.5 kB] Get:3 http://archive.ubuntu.com/ubuntu jammy/universe amd64 galera-4 amd64 26.4.9-1build1 [720 kB] Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 libdbi-perl amd64 1.643-3build3 [741 kB] Get:5 http://archive.ubuntu.com/ubuntu jammy/main amd64 libconfig-inifiles-perl all 3.000003-1 [40.5 kB] Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libmariadb3 amd64 1:10.6.18-0ubuntu0.22.04.1 [181 kB] Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-client-core-10.6 amd64 1:10.6.18-0ubuntu0.22.04.1 [974 kB] Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-client-10.6 amd64 1:10.6.18-0ubuntu0.22.04.1 [1,523 kB] Get:9 http://archive.ubuntu.com/ubuntu jammy/main amd64 libsnappy1v5 amd64 1.1.8-1build3 [17.5 kB] Get:10 http://archive.ubuntu.com/ubuntu jammy/main amd64 liburing2 amd64 2.1-2build1 [10.3 kB] Get:11 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-server-core-10.6 amd64 1:10.6.18-0ubuntu0.22.04.1 [7,694 kB] Get:12 http://archive.ubuntu.com/ubuntu jammy/main amd64 socat amd64 1.7.4.1-3ubuntu4 [349 kB] Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-server-10.6 amd64 1:10.6.18-0ubuntu0.22.04.1 [4,222 kB] Get:14 http://archive.ubuntu.com/ubuntu jammy/main amd64 libhtml-tagset-perl all 3.20-4 [12.5 kB] Get:15 http://archive.ubuntu.com/ubuntu jammy/main amd64 liburi-perl all 5.10-1 [78.8 kB] Get:16 http://archive.ubuntu.com/ubuntu jammy/main amd64 libhtml-parser-perl amd64 3.76-1build2 [88.4 kB] Get:17 http://archive.ubuntu.com/ubuntu jammy/main amd64 libcgi-pm-perl all 4.54-1 [188 kB] Get:18 http://archive.ubuntu.com/ubuntu jammy/main amd64 libfcgi0ldbl amd64 2.4.2-2build2 [28.0 kB] Get:19 http://archive.ubuntu.com/ubuntu jammy/main amd64 libfcgi-perl amd64 0.82+ds-1build1 [22.8 kB] Get:20 http://archive.ubuntu.com/ubuntu jammy/main amd64 libcgi-fast-perl all 1:2.15-1 [10.5 kB] Get:21 http://archive.ubuntu.com/ubuntu jammy/main amd64 libclone-perl amd64 0.45-1build3 [11.0 kB] Get:22 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libmysqlclient21 amd64 8.0.37-0ubuntu0.22.04.3 [1,302 kB] Get:23 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libdbd-mysql-perl amd64 4.050-5ubuntu0.22.04.1 [87.6 kB] Get:24 http://archive.ubuntu.com/ubuntu jammy/main amd64 libencode-locale-perl all 1.05-1.1 [11.8 kB] Get:25 http://archive.ubuntu.com/ubuntu jammy/main amd64 libfcgi-bin amd64 2.4.2-2build2 [11.2 kB] Get:26 http://archive.ubuntu.com/ubuntu jammy/main amd64 libhtml-template-perl all 2.97-1.1 [59.1 kB] Get:27 http://archive.ubuntu.com/ubuntu jammy/main amd64 libtimedate-perl all 2.3300-2 [34.0 kB] Get:28 http://archive.ubuntu.com/ubuntu jammy/main amd64 libhttp-date-perl all 6.05-1 [9,920 B] Get:29 http://archive.ubuntu.com/ubuntu jammy/main amd64 libio-html-perl all 1.004-2 [15.4 kB] Get:30 http://archive.ubuntu.com/ubuntu jammy/main amd64 liblwp-mediatypes-perl all 6.04-1 [19.5 kB] Get:31 http://archive.ubuntu.com/ubuntu jammy/main amd64 libhttp-message-perl all 6.36-1 [76.8 kB] Get:32 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 mariadb-server all 1:10.6.18-0ubuntu0.22.04.1 [11.8 kB] Fetched 18.6 MB in 4s (4,345 kB/s) Extracting templates from packages: 100% Preconfiguring packages ... Selecting previously unselected package mysql-common. (Reading database ... 86848 files and directories currently installed.) Preparing to unpack .../00-mysql-common_5.8+1.0.8_all.deb ... Unpacking mysql-common (5.8+1.0.8) ... Selecting previously unselected package mariadb-common. Preparing to unpack .../01-mariadb-common_1%3a10.6.18-0ubuntu0.22.04.1_all.deb ... Unpacking mariadb-common (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package galera-4. Preparing to unpack .../02-galera-4_26.4.9-1build1_amd64.deb ... Unpacking galera-4 (26.4.9-1build1) ... Selecting previously unselected package libdbi-perl:amd64. Preparing to unpack .../03-libdbi-perl_1.643-3build3_amd64.deb ... Unpacking libdbi-perl:amd64 (1.643-3build3) ... Selecting previously unselected package libconfig-inifiles-perl. Preparing to unpack .../04-libconfig-inifiles-perl_3.000003-1_all.deb ... Unpacking libconfig-inifiles-perl (3.000003-1) ... Selecting previously unselected package libmariadb3:amd64. Preparing to unpack .../05-libmariadb3_1%3a10.6.18-0ubuntu0.22.04.1_amd64.deb ... Unpacking libmariadb3:amd64 (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package mariadb-client-core-10.6. Preparing to unpack .../06-mariadb-client-core-10.6_1%3a10.6.18-0ubuntu0.22.04.1_amd64.deb ... Unpacking mariadb-client-core-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package mariadb-client-10.6. Preparing to unpack .../07-mariadb-client-10.6_1%3a10.6.18-0ubuntu0.22.04.1_amd64.deb ... Unpacking mariadb-client-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package libsnappy1v5:amd64. Preparing to unpack .../08-libsnappy1v5_1.1.8-1build3_amd64.deb ... Unpacking libsnappy1v5:amd64 (1.1.8-1build3) ... Selecting previously unselected package liburing2:amd64. Preparing to unpack .../09-liburing2_2.1-2build1_amd64.deb ... Unpacking liburing2:amd64 (2.1-2build1) ... Selecting previously unselected package mariadb-server-core-10.6. Preparing to unpack .../10-mariadb-server-core-10.6_1%3a10.6.18-0ubuntu0.22.04.1_amd64.deb ... Unpacking mariadb-server-core-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package socat. Preparing to unpack .../11-socat_1.7.4.1-3ubuntu4_amd64.deb ... Unpacking socat (1.7.4.1-3ubuntu4) ... Setting up mysql-common (5.8+1.0.8) ... update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode Setting up mariadb-common (1:10.6.18-0ubuntu0.22.04.1) ... update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode Selecting previously unselected package mariadb-server-10.6. (Reading database ... 87291 files and directories currently installed.) Preparing to unpack .../00-mariadb-server-10.6_1%3a10.6.18-0ubuntu0.22.04.1_amd64.deb ... Unpacking mariadb-server-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Selecting previously unselected package libhtml-tagset-perl. Preparing to unpack .../01-libhtml-tagset-perl_3.20-4_all.deb ... Unpacking libhtml-tagset-perl (3.20-4) ... Selecting previously unselected package liburi-perl. Preparing to unpack .../02-liburi-perl_5.10-1_all.deb ... Unpacking liburi-perl (5.10-1) ... Selecting previously unselected package libhtml-parser-perl:amd64. Preparing to unpack .../03-libhtml-parser-perl_3.76-1build2_amd64.deb ... Unpacking libhtml-parser-perl:amd64 (3.76-1build2) ... Selecting previously unselected package libcgi-pm-perl. Preparing to unpack .../04-libcgi-pm-perl_4.54-1_all.deb ... Unpacking libcgi-pm-perl (4.54-1) ... Selecting previously unselected package libfcgi0ldbl:amd64. Preparing to unpack .../05-libfcgi0ldbl_2.4.2-2build2_amd64.deb ... Unpacking libfcgi0ldbl:amd64 (2.4.2-2build2) ... Selecting previously unselected package libfcgi-perl:amd64. Preparing to unpack .../06-libfcgi-perl_0.82+ds-1build1_amd64.deb ... Unpacking libfcgi-perl:amd64 (0.82+ds-1build1) ... Selecting previously unselected package libcgi-fast-perl. Preparing to unpack .../07-libcgi-fast-perl_1%3a2.15-1_all.deb ... Unpacking libcgi-fast-perl (1:2.15-1) ... Selecting previously unselected package libclone-perl. Preparing to unpack .../08-libclone-perl_0.45-1build3_amd64.deb ... Unpacking libclone-perl (0.45-1build3) ... Selecting previously unselected package libmysqlclient21:amd64. Preparing to unpack .../09-libmysqlclient21_8.0.37-0ubuntu0.22.04.3_amd64.deb ... Unpacking libmysqlclient21:amd64 (8.0.37-0ubuntu0.22.04.3) ... Selecting previously unselected package libdbd-mysql-perl:amd64. Preparing to unpack .../10-libdbd-mysql-perl_4.050-5ubuntu0.22.04.1_amd64.deb ... Unpacking libdbd-mysql-perl:amd64 (4.050-5ubuntu0.22.04.1) ... Selecting previously unselected package libencode-locale-perl. Preparing to unpack .../11-libencode-locale-perl_1.05-1.1_all.deb ... Unpacking libencode-locale-perl (1.05-1.1) ... Selecting previously unselected package libfcgi-bin. Preparing to unpack .../12-libfcgi-bin_2.4.2-2build2_amd64.deb ... Unpacking libfcgi-bin (2.4.2-2build2) ... Selecting previously unselected package libhtml-template-perl. Preparing to unpack .../13-libhtml-template-perl_2.97-1.1_all.deb ... Unpacking libhtml-template-perl (2.97-1.1) ... Selecting previously unselected package libtimedate-perl. Preparing to unpack .../14-libtimedate-perl_2.3300-2_all.deb ... Unpacking libtimedate-perl (2.3300-2) ... Selecting previously unselected package libhttp-date-perl. Preparing to unpack .../15-libhttp-date-perl_6.05-1_all.deb ... Unpacking libhttp-date-perl (6.05-1) ... Selecting previously unselected package libio-html-perl. Preparing to unpack .../16-libio-html-perl_1.004-2_all.deb ... Unpacking libio-html-perl (1.004-2) ... Selecting previously unselected package liblwp-mediatypes-perl. Preparing to unpack .../17-liblwp-mediatypes-perl_6.04-1_all.deb ... Unpacking liblwp-mediatypes-perl (6.04-1) ... Selecting previously unselected package libhttp-message-perl. Preparing to unpack .../18-libhttp-message-perl_6.36-1_all.deb ... Unpacking libhttp-message-perl (6.36-1) ... Selecting previously unselected package mariadb-server. Preparing to unpack .../19-mariadb-server_1%3a10.6.18-0ubuntu0.22.04.1_all.deb ... Unpacking mariadb-server (1:10.6.18-0ubuntu0.22.04.1) ... Setting up libconfig-inifiles-perl (3.000003-1) ... Setting up galera-4 (26.4.9-1build1) ... Setting up libmysqlclient21:amd64 (8.0.37-0ubuntu0.22.04.3) ... Setting up libfcgi0ldbl:amd64 (2.4.2-2build2) ... Setting up libclone-perl (0.45-1build3) ... Setting up libhtml-tagset-perl (3.20-4) ... Setting up liblwp-mediatypes-perl (6.04-1) ... Setting up libfcgi-bin (2.4.2-2build2) ... Setting up libencode-locale-perl (1.05-1.1) ... Setting up libsnappy1v5:amd64 (1.1.8-1build3) ... Setting up socat (1.7.4.1-3ubuntu4) ... Setting up libio-html-perl (1.004-2) ... Setting up libmariadb3:amd64 (1:10.6.18-0ubuntu0.22.04.1) ... Setting up libtimedate-perl (2.3300-2) ... Setting up libfcgi-perl:amd64 (0.82+ds-1build1) ... Setting up liburing2:amd64 (2.1-2build1) ... Setting up liburi-perl (5.10-1) ... Setting up libdbi-perl:amd64 (1.643-3build3) ... Setting up mariadb-server-core-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Setting up libhttp-date-perl (6.05-1) ... Setting up mariadb-client-core-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Setting up libdbd-mysql-perl:amd64 (4.050-5ubuntu0.22.04.1) ... Setting up libhtml-parser-perl:amd64 (3.76-1build2) ... Setting up mariadb-client-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Setting up libhttp-message-perl (6.36-1) ... Setting up libcgi-pm-perl (4.54-1) ... Setting up libhtml-template-perl (2.97-1.1) ... Setting up mariadb-server-10.6 (1:10.6.18-0ubuntu0.22.04.1) ... Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /lib/systemd/system/mariadb.service. Setting up libcgi-fast-perl (1:2.15-1) ... Setting up mariadb-server (1:10.6.18-0ubuntu0.22.04.1) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for libc-bin (2.35-0ubuntu3.8) ... Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. root@cloud-one:~#
root@cloud-one:~# systemctl start mariadb root@cloud-one:~# systemctl status mariadb ● mariadb.service - MariaDB 10.6.18 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2024-07-27 01:55:24 UTC; 1min 26s ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 23991 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, stat> Process: 23992 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, sta> Process: 24000 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..;> Process: 24047 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, st> Process: 24049 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS) Main PID: 24034 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 8 (limit: 61966) Memory: 60.8M CPU: 533ms CGroup: /system.slice/mariadb.service └─24034 /usr/sbin/mariadbd Jul 27 01:55:24 cloud-one mariadbd[24034]: Version: '10.6.18-MariaDB-0ubuntu0.22.04.1' socket: '/run/mysqld/m> Jul 27 01:55:24 cloud-one systemd[1]: Started MariaDB 10.6.18 database server. Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24051]: Upgrading MySQL tables if necessary. Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24054]: Looking for 'mariadb' as: /usr/bin/mariadb Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24054]: Looking for 'mariadb-check' as: /usr/bin/mariadb-che> Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24054]: This installation of MariaDB is already upgraded to > Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24054]: There is no need to run mysql_upgrade again for 10.6> Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24054]: You can use --force if you still want to run mysql_u> Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24062]: Checking for insecure root accounts. Jul 27 01:55:24 cloud-one /etc/mysql/debian-start[24066]: Triggering myisam-recover for all MyISAM tables and > lines 1-28/28 (END) ^C root@cloud-one:~# systemctl enable mariadb Synchronizing state of mariadb.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable mariadb root@cloud-one:~#
Menguatkan / mengamankan server mariadb
sudo mysql_secure_installation
root@cloud-one:~# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] Enabled successfully! Reloading privilege tables.. ... Success! You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB! root@cloud-one:~#
Membuat database dan user
root@cloud-one:~# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 49 Server version: 10.3.39-MariaDB-0ubuntu0.20.04.2 Ubuntu 20.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE dbowncloud; Query OK, 1 row affected (0.003 sec) MariaDB [(none)]> CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'p4ssw0rdx'; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> MariaDB [(none)]> GRANT ALL PRIVILEGES ON dbowncloud.* TO 'ownclouduser'@'localhost'; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.000 sec) MariaDB [(none)]> MariaDB [(none)]> exit; Bye root@cloud-dev:~#
Ujicoba user
root@cloud-dev:~# mysql -u ownclouduser -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 50 Server version: 10.3.39-MariaDB-0ubuntu0.20.04.2 Ubuntu 20.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | dbowncloud | | information_schema | +--------------------+ 2 rows in set (0.001 sec) MariaDB [(none)]> MariaDB [(none)]> exit Bye root@cloud-dev:~#
Mengakses alamat webserver melalui web browser