To backup all your sql-ledger data, follow these steps:
1. Database.
Use the 'System–Backup' menu option to backup your database.
You can also use pg_dump to backup your db from your linux console:
pg_dump -U sql-ledger your-db-name | gzip -c > your-db-name.sql.gz
2. Users
Backup sql-ledger/users/ folder. This folder contains information (access rights, password etc.) of all logins.
cd /usr/local/sql-ledger/ tar -czvf users.tar.gz users/
3. Templates
Backup sql-ledger/templates/yourtemplates/ folder. This folder contains any customized invoice/orders etc. templates which you may have customized using the System–Templates menu option.
cd /usr/local/sql-ledger/templates/ tar -czvf your-templates.tar.gz your-templates/
To restore your data on the same server or a new server, follow these steps.
1. If you are restoring your backup on the same server, you will need to delete your existing database before creating the new one. Follow this step with care.
dropdb -U sql-ledger your-db-name
2. Create a new database, uncompress your backup and restore
createdb -U sql-ledger -E SQL_ASCII your-db-name gunzip your-db-name.sql.gz psql -U sql-ledger your-db-name < your-db-name.sql
3. Copy users.tar.gz to sql-ledger folder and uncompress with tar -xzvf users.tar.gz
4. Copy your-templates.tar.gz to sql-ledger/templates folder and uncompress with tar -xzvf your-templates.tar.gz
1. The above postgresql commands assume you have a database user/role named sql-ledger. If you don't have this user, use either 'postgres' (for most Linux systems) or 'pgsql' (for FreeBSD port) instead of 'sql-ledger'.
2. It is usually more important to backup your postgres database with contains all your customers/vendors/transactions. You can always recreate users and edit templates in a new installation if you forget to backup these.
3. You might need to edit your users through admin.pl if the new database name is different from the old one or the database connection information (host, user, password) is different.
4. For simplicity sake, there is no harm in backing up entire sql-ledger folder instead of individually backing up users and templates folders. Make sure you don't have redundant database backups in users folder otherwise your backup may be quite large. You will still need to backup your database separately.