Skip to content

lindesvard/ubuntu-helper-script

Repository files navigation

ubuntu-helper-script

Setup VPS

SSH into your machine

curl -o setup-vps.sh https://raw.githubusercontent.com/lindesvard/ubuntu-helper-script/master/setup-vps.sh && sudo chmod +x setup-vps.sh && ./setup-vps.sh

Then run: ./setup-vps.sh

Install NVM

curl -o install-nvm.sh https://raw.githubusercontent.com/lindesvard/ubuntu-helper-script/master/install-nvm.sh && sudo chmod +x install-nvm.sh && ./install-nvm.sh

Create MySQL database with user

Before you can run this command you need to change $MYSQL_USER and $MYSQL_PASSWORD in create-db.sh.

This command will create a database and a user. Replace {{db_name}}, {{db_user}} and {{db_password}} with your config.

sh create-db.sh {{db_name}} {{db_user}} {{db_password}}

Export database

pg_dump -U difstart_user difstart_db --password >> db_dump.sql

pg_dump --data-only --inserts --column-inserts -U difstart_user difstart_db --password >> db_dump.sql

pg_dump --data-only --inserts --column-inserts -U difstart_user difstart_db --password -t '"Sources"' -t '"Articles"' -t '"ArticleTags"' -t '"KeywordTags"' >> rest.sql

Export database but only data no structure

pg_dump --data-only -U difstart_user difstart_db --password >> db_dump_data.sql

Import database

psql -U difstart_user difstart_cms --password < db_dump.sql
pg_restore -U difstart_user difstart_cms --password -F t -f 

Download file from remote server

rsync -chavzP -e "ssh -p 22123" web@128.199.50.203:/var/lib/postgresql/db_dump.sql ./db_dump.sql

Send file to remote server

rsync -chavzP -e "ssh -p 22321" ./db_dump.sql web@192.81.223.173:/home/web/db_dump.sql

Restart postgres

systemctl unmask postgresql
systemctl restart postgresql

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages