Difference between revisions of "USB OFFLINE: Ubuntu 24.04 Moodle Backup"

From OnnoWiki
Jump to navigation Jump to search
(Created page with "Moodle Backup mkdir -p /var/www/html/pustaka/backupmoodle cd /var/www/html/pustaka/backupmoodle mv moodle-database.sql.gz moodle-database-old.sql.gz mysqldump -h localhos...")
 
Line 10: Line 10:
 
  chmod -Rf 777 /var/www/html/pustaka/backupmoodle
 
  chmod -Rf 777 /var/www/html/pustaka/backupmoodle
 
  chown -Rf nobody.nogroup /var/www/html/pustaka/backupmoodle
 
  chown -Rf nobody.nogroup /var/www/html/pustaka/backupmoodle
 +
 +
Moodle Restore
 +
 +
cp /var/www/html/moodle/config.php
 +
cd /var/www/html/pustaka/backupmoodle/
 +
rm -Rf /var/www/html/moodle
 +
rm -Rf /var/moodledata
 +
tar zxvf moodlecms.tar.gz
 +
mv /var/www/html/pustaka/backupmoodle/var/www/moodle/ /var/www/html/
 +
tar zxvf moodledata.tar.gz
 +
mv /var/www/html/pustaka/backupmoodle/var/moodledata /var
 +
rm -Rf /var/www/html/pustaka/backupmoodle/var/
 +
cp /tmp/config.php /var/www/html/moodle
 +
chown -Rf www-data.www-data /var/www/html/moodle
 +
chown -Rf www-data.www-data /var/moodledata &
 +
cd /var/www/html/pustaka/backupmoodle
 +
gunzip moodle-database.sql.gz
 +
mysqladmin --user=moodle --password=moodle --force drop moodle
 +
mysqladmin --user=moodle --password=moodle create moodle
 +
mysql -u moodle -pmoodle moodle < /var/www/html/pustaka/backupmoodle/moodle-database.sql
 +
service mysql stop
 +
service mysql start

Revision as of 04:31, 1 September 2024

Moodle Backup

mkdir -p /var/www/html/pustaka/backupmoodle
cd /var/www/html/pustaka/backupmoodle
mv moodle-database.sql.gz moodle-database-old.sql.gz
mysqldump -h localhost -u moodle --password=moodle -C -Q -e --create-options moodle > moodle-database.sql
gzip moodle-database.sql
tar czf /var/www/html/pustaka/backupmoodle/moodlecms.tar.gz /var/www/html/moodle
tar czf /var/www/html/pustaka/backupmoodle/moodledata.tar.gz /var/moodledata/
chmod -Rf 777 /var/www/html/pustaka/backupmoodle
chown -Rf nobody.nogroup /var/www/html/pustaka/backupmoodle

Moodle Restore

cp /var/www/html/moodle/config.php
cd /var/www/html/pustaka/backupmoodle/
rm -Rf /var/www/html/moodle
rm -Rf /var/moodledata
tar zxvf moodlecms.tar.gz
mv /var/www/html/pustaka/backupmoodle/var/www/moodle/ /var/www/html/
tar zxvf moodledata.tar.gz
mv /var/www/html/pustaka/backupmoodle/var/moodledata /var
rm -Rf /var/www/html/pustaka/backupmoodle/var/
cp /tmp/config.php /var/www/html/moodle
chown -Rf www-data.www-data /var/www/html/moodle
chown -Rf www-data.www-data /var/moodledata &
cd /var/www/html/pustaka/backupmoodle
gunzip moodle-database.sql.gz
mysqladmin --user=moodle --password=moodle --force drop moodle
mysqladmin --user=moodle --password=moodle create moodle
mysql -u moodle -pmoodle moodle < /var/www/html/pustaka/backupmoodle/moodle-database.sql
service mysql stop
service mysql start