linux:digitalocean
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
linux:digitalocean [2014/12/27 04:24] – [secure ssh] admin | linux:digitalocean [2022/10/29 16:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Moving web from hostgator to DigitalOcean ====== | ====== Moving web from hostgator to DigitalOcean ====== | ||
+ | |||
===== 1. Install missing components on DigitalOcean ===== | ===== 1. Install missing components on DigitalOcean ===== | ||
==== install basic packages ==== | ==== install basic packages ==== | ||
<code bash> | <code bash> | ||
yum install vim mc man telnet | yum install vim mc man telnet | ||
+ | </ | ||
+ | ==== create swap file for your linux server ==== | ||
+ | Most **cloud virtual machine providers do not set up swapfiles** as part of their server provisioning. | ||
+ | |||
+ | If you are running the recommended 2 GB of memory for Discourse, a swap file is technically not required, but can be helpful just **in case your server experiences memory pressure.** With a swap file, rather than **randomly terminating processes with an out of memory error**, things will slow down instead. | ||
+ | |||
+ | This can be done at any time from the command line on your server. | ||
+ | |||
+ | Set up a 1 GB swap file | ||
+ | |||
+ | Adding a swap file gives Discourse some extra breathing room during memory-intensive operations. 1GB swap should suffice, though if you are attempting the minimum memory configuration you should set up a 2GB swap. | ||
+ | |||
+ | In the shell you have opened to your droplet, do the following: | ||
+ | - Step1: Check your swap on<code bash> | ||
+ | swapon -s | ||
+ | </ | ||
+ | - Step2: Create an empty swapfile< | ||
+ | sudo install -o root -g root -m 0600 /dev/null /swapfile | ||
+ | </ | ||
+ | - Step3: write out a 1 GB file named ' | ||
+ | dd if=/ | ||
+ | </ | ||
+ | - Step4: tell linux this is the swap file:< | ||
+ | mkswap /swapfile | ||
+ | </ | ||
+ | - Step5: Activate it<code bash> | ||
+ | swapon /swapfile | ||
+ | </ | ||
+ | - Step6: Add it to the file system table so its there after reboot:< | ||
+ | echo "/ | ||
+ | </ | ||
+ | - Step7: Set the swappiness to 10 so its only uses as an emergency buffer< | ||
+ | sudo sysctl -w vm.swappiness=10 | ||
+ | echo vm.swappiness = 10 | sudo tee -a / | ||
</ | </ | ||
==== mysqld ==== | ==== mysqld ==== | ||
Line 24: | Line 59: | ||
yum install php-mysql.x86_64 | yum install php-mysql.x86_64 | ||
</ | </ | ||
- | ===== 2. copy data from hostgator to Digitalocean ===== | + | |
+ | ===== 2. Copy data from hostgator to Digitalocean ===== | ||
==== create backup file for web and database on Hostgator ==== | ==== create backup file for web and database on Hostgator ==== | ||
=== backup web === | === backup web === | ||
Line 36: | Line 72: | ||
</ | </ | ||
==== copy data to Digitalocean with scp ==== | ==== copy data to Digitalocean with scp ==== | ||
+ | (To run scp, you must install openssh-clients both client and server) | ||
* check ssh connect: <code bash> | * check ssh connect: <code bash> | ||
ssh -p 2222 anhvc@192.232.218.215 | ssh -p 2222 anhvc@192.232.218.215 | ||
- | | + | </ |
* scp<code bash> | * scp<code bash> | ||
scp -P 2222 anhvc@192.232.218.215: | scp -P 2222 anhvc@192.232.218.215: | ||
scp -P 2222 anhvc@192.232.218.215: | scp -P 2222 anhvc@192.232.218.215: | ||
- | | + | </ |
===== 3.Import database and config to run web on DigitalOcean ===== | ===== 3.Import database and config to run web on DigitalOcean ===== | ||
==== Import database ==== | ==== Import database ==== | ||
* create database:< | * create database:< | ||
mysqladmin create babyshopvn; | mysqladmin create babyshopvn; | ||
- | | + | </ |
* Import database:< | * Import database:< | ||
mysql -f --default-character-set=utf8 -uroot babyshopvn < babyshopvn.sql | mysql -f --default-character-set=utf8 -uroot babyshopvn < babyshopvn.sql | ||
- | | + | </ |
==== config httpd ==== | ==== config httpd ==== | ||
=== check location of httpd config file === | === check location of httpd config file === | ||
Line 96: | Line 133: | ||
</ | </ | ||
</ | </ | ||
- | === Create | + | === create |
Create helloworld.php in / | Create helloworld.php in / | ||
<code php> | <code php> | ||
Line 157: | Line 194: | ||
* secure user:< | * secure user:< | ||
AllowUsers root anhvc | AllowUsers root anhvc | ||
+ | </ | ||
+ | * change usedns in sshd.conf< | ||
+ | UseDNS no | ||
</ | </ | ||
==== config php debug ==== | ==== config php debug ==== |
linux/digitalocean.1419654279.txt.gz · Last modified: 2022/10/29 16:15 (external edit)