nextcloud_dans_lxc_-_2
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
nextcloud_dans_lxc_-_2 [2019/10/29 09:55] – [MariaDB] simon | nextcloud_dans_lxc_-_2 [Date inconnue] (Version actuelle) – supprimée - modification externe (Date inconnue) 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Nextcloud dans lxc - 2 ====== | ||
- | <WRAP center round important 60%> | ||
- | 29/10/2019 : Essais d'une installation complète en suivant le tutoriel [[https:// | ||
- | </ | ||
- | ===== lxc ===== | ||
- | <code bash> | ||
- | lxc-create -t download -n nextcloud2 -- --dist debian --release buster --arch amd64 | ||
- | </ | ||
- | |||
- | On configure ce qu'il faut pour avoir une IP statique (voir [[lxc]]). | ||
- | |||
- | ===== prérequis ===== | ||
- | <code bash> | ||
- | # lxc-attach nextcloud2 | ||
- | |||
- | root@nextcloud2:/# | ||
- | |||
- | root@nextcloud2:/# | ||
- | </ | ||
- | |||
- | ===== Dépôts pour Nginx, PHP et MariaDB ===== | ||
- | ==== Nginx ==== | ||
- | <code bash> | ||
- | # cd / | ||
- | |||
- | # echo "deb [arch=amd64] http:// | ||
- | |||
- | # curl -fsSL https:// | ||
- | </ | ||
- | |||
- | ==== PHP ==== | ||
- | <code bash> | ||
- | # cd / | ||
- | |||
- | # echo "deb [arch=amd64] https:// | ||
- | |||
- | # root@nextcloud2:/ | ||
- | OK | ||
- | </ | ||
- | |||
- | ==== MariaDB ==== | ||
- | <code bash> | ||
- | # cd / | ||
- | |||
- | # echo "deb [arch=amd64] http:// | ||
- | |||
- | # apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 | ||
- | Executing: / | ||
- | gpg: clef F1656F24C74CD1D8 : | ||
- | gpg: | ||
- | gpg: | ||
- | </ | ||
- | |||
- | ==== Upgrade ==== | ||
- | |||
- | On met à jour : | ||
- | <code bash> | ||
- | # apt update && apt upgrade -y | ||
- | |||
- | # make-ssl-cert generate-default-snakeoil -y | ||
- | |||
- | # apt remove nginx nginx-extras nginx-common nginx-full -y --allow-change-held-packages | ||
- | |||
- | # apt autoremove | ||
- | </ | ||
- | |||
- | ===== Installations et configurations ===== | ||
- | ==== Nginx ==== | ||
- | <code bash> | ||
- | # apt install nginx -y | ||
- | |||
- | # nginx -V | ||
- | nginx version: nginx/ | ||
- | |||
- | # systemctl enable nginx.service | ||
- | |||
- | # mv / | ||
- | |||
- | root@nextcloud2:/ | ||
- | (...) | ||
- | 27: eth0@if28: < | ||
- | (...) | ||
- | inet 10.0.3.162/ | ||
- | (...) | ||
- | |||
- | root@nextcloud2:/ | ||
- | |||
- | root@nextcloud2:/ | ||
- | user www-data; | ||
- | worker_processes auto; | ||
- | pid / | ||
- | |||
- | events { | ||
- | worker_connections 1024; | ||
- | multi_accept on; | ||
- | use epoll; | ||
- | } | ||
- | |||
- | http { | ||
- | server_names_hash_bucket_size 64; | ||
- | upstream php-handler { | ||
- | server unix:/ | ||
- | } | ||
- | |||
- | set_real_ip_from 127.0.0.1; | ||
- | set_real_ip_from 10.0.3.0/ | ||
- | real_ip_header X-Forwarded-For; | ||
- | real_ip_recursive on; | ||
- | include / | ||
- | #include / | ||
- | #include / | ||
- | #include / | ||
- | #include / | ||
- | default_type application/ | ||
- | access_log / | ||
- | error_log / | ||
- | sendfile on; | ||
- | send_timeout 3600; | ||
- | tcp_nopush on; | ||
- | tcp_nodelay on; | ||
- | open_file_cache max=500 inactive=10m; | ||
- | open_file_cache_errors on; | ||
- | keepalive_timeout 65; | ||
- | reset_timedout_connection on; | ||
- | server_tokens off; | ||
- | resolver 10.0.3.162 valid=30s; | ||
- | #resolver 127.0.0.53 valid=30s; is recommended but reuqires a valid resolver configuration | ||
- | resolver_timeout 5s; | ||
- | include / | ||
- | } | ||
- | </ | ||
- | |||
- | On teste la config et on redémarre nginx : | ||
- | <code bash> | ||
- | # nginx -t && service nginx restart | ||
- | </ | ||
- | |||
- | On crée le dossier nextcloud et on lui met les bons droits : | ||
- | <code bash> | ||
- | # mkdir -p / | ||
- | |||
- | # chown -R www-data: | ||
- | </ | ||
- | |||
- | ==== PHP ==== | ||
- | <code bash> | ||
- | # apt update && apt install php7.3-fpm php7.3-gd php7.3-mysql php7.3-curl php7.3-xml php7.3-zip php7.3-intl php7.3-mbstring php7.3-json php7.3-bz2 php7.3-ldap php-apcu imagemagick php-imagick php-smbclient -y | ||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | Je ne mets pas de "#" | ||
- | </ | ||
- | |||
- | |||
- | Backup des configurations : | ||
- | <code bash> | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | cp / | ||
- | |||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | |||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | |||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | |||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | sed -i " | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | # service php7.3-fpm restart | ||
- | # service nginx restart | ||
- | </ | ||
- | |||
- | ==== MariaDB ==== | ||
- | <code bash> | ||
- | # apt update && apt install mariadb-server -y | ||
- | |||
- | # mysql --version | ||
- | mysql Ver 15.1 Distrib 10.4.8-MariaDB, | ||
- | </ | ||
- | |||
- | Le service ne démarre pas : | ||
- | <code bash> | ||
- | root@nextcloud2:/ | ||
- | ● mariadb.service - MariaDB 10.4.8 database server | ||
- | | ||
- | Drop-In: / | ||
- | | ||
- | | ||
- | Docs: man: | ||
- | | ||
- | |||
- | oct 29 09:02:09 nextcloud2 systemd[1]: Starting MariaDB 10.4.8 database server... | ||
- | oct 29 09:02:09 nextcloud2 systemd[18087]: | ||
- | oct 29 09:02:09 nextcloud2 systemd[18087]: | ||
- | oct 29 09:02:09 nextcloud2 systemd[1]: mariadb.service: | ||
- | oct 29 09:02:09 nextcloud2 systemd[1]: mariadb.service: | ||
- | oct 29 09:02:09 nextcloud2 systemd[1]: Failed to start MariaDB 10.4.8 database server. | ||
- | </ | ||
- | |||
- | Après quelques recherches sur les internets, j'ai vu que le soucis semble causé par AppArmor. Pour le désactiver : | ||
- | <code bash> | ||
- | # cat / | ||
- | (...) | ||
- | lxc.apparmor.profile = unconfined | ||
- | (...) | ||
- | </ | ||
- | |||
- | Il faut ensuite redémarrer le conteneur : | ||
- | <code bash> | ||
- | # lxc-stop nextcloud2 | ||
- | # lxc-start nextcloud2 | ||
- | </ | ||
- | |||
- | On sécurise l' | ||
- | <code bash> | ||
- | root@nextcloud2: | ||
- | |||
- | 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' | ||
- | |||
- | 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 ' | ||
- | |||
- | Switch to unix_socket authentication [Y/n] N | ||
- | ... skipping. | ||
- | |||
- | You already have your root account protected, so you can safely answer ' | ||
- | |||
- | Change the root password? [Y/n] n | ||
- | ... skipping. | ||
- | |||
- | 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. | ||
- | production environment. | ||
- | |||
- | Remove anonymous users? [Y/n] y | ||
- | ... Success! | ||
- | |||
- | Normally, root should only be allowed to connect from ' | ||
- | ensures that someone cannot guess at the root password from the network. | ||
- | |||
- | Disallow root login remotely? [Y/n] y | ||
- | ... Success! | ||
- | |||
- | By default, MariaDB comes with a database named ' | ||
- | access. | ||
- | before moving into a production environment. | ||
- | |||
- | Remove test database and access to it? [Y/n] y | ||
- | - 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] y | ||
- | ... 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! | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | root@nextcloud3: | ||
- | root@nextcloud3: | ||
- | root@nextcloud3: | ||
- | root@nextcloud3: | ||
- | [client] | ||
- | default-character-set = utf8mb4 | ||
- | port = 3306 | ||
- | socket = / | ||
- | [mysqld_safe] | ||
- | log_error=/ | ||
- | nice = 0 | ||
- | socket = / | ||
- | [mysqld] | ||
- | basedir = /usr | ||
- | bind-address = 127.0.0.1 | ||
- | binlog_format = ROW | ||
- | bulk_insert_buffer_size = 16M | ||
- | character-set-server = utf8mb4 | ||
- | collation-server = utf8mb4_general_ci | ||
- | concurrent_insert = 2 | ||
- | connect_timeout = 5 | ||
- | datadir = / | ||
- | default_storage_engine = InnoDB | ||
- | expire_logs_days = 10 | ||
- | general_log_file = / | ||
- | general_log = 0 | ||
- | innodb_buffer_pool_size = 1024M | ||
- | innodb_buffer_pool_instances = 1 | ||
- | innodb_flush_log_at_trx_commit = 2 | ||
- | innodb_log_buffer_size = 32M | ||
- | innodb_max_dirty_pages_pct = 90 | ||
- | innodb_file_per_table = 1 | ||
- | innodb_open_files = 400 | ||
- | innodb_io_capacity = 4000 | ||
- | innodb_flush_method = O_DIRECT | ||
- | key_buffer_size = 128M | ||
- | lc_messages_dir = / | ||
- | lc_messages = en_US | ||
- | log_bin = / | ||
- | log_bin_index = / | ||
- | log_error=/ | ||
- | log_slow_verbosity = query_plan | ||
- | log_warnings = 2 | ||
- | long_query_time = 1 | ||
- | max_allowed_packet = 16M | ||
- | max_binlog_size = 100M | ||
- | max_connections = 200 | ||
- | max_heap_table_size = 64M | ||
- | myisam_recover_options = BACKUP | ||
- | myisam_sort_buffer_size = 512M | ||
- | port = 3306 | ||
- | pid-file = / | ||
- | query_cache_limit = 2M | ||
- | query_cache_size = 64M | ||
- | query_cache_type = 1 | ||
- | query_cache_min_res_unit = 2k | ||
- | read_buffer_size = 2M | ||
- | read_rnd_buffer_size = 1M | ||
- | skip-external-locking | ||
- | skip-name-resolve | ||
- | slow_query_log_file = / | ||
- | slow-query-log = 1 | ||
- | socket = / | ||
- | sort_buffer_size = 4M | ||
- | table_open_cache = 400 | ||
- | thread_cache_size = 128 | ||
- | tmp_table_size = 64M | ||
- | tmpdir = /tmp | ||
- | transaction_isolation = READ-COMMITTED | ||
- | user = mysql | ||
- | wait_timeout = 600 | ||
- | [mysqldump] | ||
- | max_allowed_packet = 16M | ||
- | quick | ||
- | quote-names | ||
- | [isamchk] | ||
- | key_buffer = 16M | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | root@nextcloud2: | ||
- | root@nextcloud2: | ||
- | ● mariadb.service - MariaDB 10.4.8 database server | ||
- | | ||
- | Drop-In: / | ||
- | | ||
- | | ||
- | Docs: man: | ||
- | | ||
- | Process: 474 ExecStartPre=/ | ||
- | Process: 475 ExecStartPre=/ | ||
- | Process: 477 ExecStartPre=/ | ||
- | Process: 693 ExecStartPost=/ | ||
- | Process: 696 ExecStartPost=/ | ||
- | Main PID: 661 (mysqld) | ||
- | | ||
- | Tasks: 32 (limit: 4915) | ||
- | | ||
- | | ||
- | | ||
- | |||
- | oct 29 09:50:35 nextcloud2 systemd[1]: Starting MariaDB 10.4.8 database server... | ||
- | oct 29 09:50:36 nextcloud2 mysqld[661]: | ||
- | oct 29 09:50:36 nextcloud2 / | ||
- | oct 29 09:50:36 nextcloud2 / | ||
- | oct 29 09:50:36 nextcloud2 / | ||
- | oct 29 09:50:36 nextcloud2 systemd[1]: Started MariaDB 10.4.8 database server. | ||
- | </ | ||
- | |||
- | On se connecte à MariaDB et on crée l' | ||
- | <code bash> | ||
- | # mysql -uroot -p | ||
- | |||
- | MariaDB [(none)]> | ||
- | Query OK, 1 row affected (0.001 sec) | ||
- | |||
- | MariaDB [(none)]> | ||
- | Query OK, 0 rows affected (0.002 sec) | ||
- | |||
- | MariaDB [(none)]> | ||
- | Query OK, 0 rows affected (0.001 sec) | ||
- | |||
- | Query OK, 0 rows affected (0.000 sec) | ||
- | |||
- | Bye | ||
- | </ | ||
- | |||
- | Vérification : | ||
- | <code bash> | ||
- | root@nextcloud3: | ||
- | Enter password: | ||
- | +----------------+ | ||
- | | @@TX_ISOLATION | | ||
- | +----------------+ | ||
- | | READ-COMMITTED | | ||
- | +----------------+ | ||
- | +-----------+---------+--------------------+ | ||
- | | database | ||
- | +-----------+---------+--------------------+ | ||
- | | nextcloud | utf8mb4 | utf8mb4_general_ci | | ||
- | +-----------+---------+--------------------+ | ||
- | </ |
nextcloud_dans_lxc_-_2.1572342933.txt.gz · Dernière modification : 2020/08/09 12:59 (modification externe)