Cloning: Difference between revisions
introduce an article for cloning DO droplet |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
||
| Line 14: | Line 14: | ||
===on System A=== | ===on System A=== | ||
< | <syntaxhighlight lang="bash"> | ||
sudo dpkg --get-selections > package-list.txt | sudo dpkg --get-selections > package-list.txt | ||
</ | </syntaxhighlight> | ||
copy package-list.txt from System A to System B | copy package-list.txt from System A to System B | ||
===on System B=== | ===on System B=== | ||
< | <syntaxhighlight lang="bash"> | ||
sudo dpkg --set-selections < package-list.txt | sudo dpkg --set-selections < package-list.txt | ||
sudo apt-get -u dselect-upgrade | sudo apt-get -u dselect-upgrade | ||
</ | </syntaxhighlight> | ||
You might get 'database' errors, in which case you should install <code>dselect</code> and update that as well (all as root, or with sudo): | You might get 'database' errors, in which case you should install <code>dselect</code> and update that as well (all as root, or with sudo): | ||
< | <syntaxhighlight lang="bash"> | ||
apt-get update | apt-get update | ||
apt-get install dselect | apt-get install dselect | ||
dselect update | dselect update | ||
apt-get -u dselect-upgrade | apt-get -u dselect-upgrade | ||
</ | </syntaxhighlight> | ||
There are other tools to do the job too, and the tools you want to use for this depend on how automated you aim for this task to be, and how much you need/want to be able to customize each machine as it's being installed. | There are other tools to do the job too, and the tools you want to use for this depend on how automated you aim for this task to be, and how much you need/want to be able to customize each machine as it's being installed. | ||
| Line 61: | Line 61: | ||
==Replicating a PHP installation== | ==Replicating a PHP installation== | ||
With the PHP CLI installed, you can use <code>php -m</code> to get a list of the compiled-in modules for your PHP installation. This is the same as you would find by using the <code>phpinfo();</code> function in a script, except that you get exactly the info you need, in a list format that you can use. That list can show you what you might need to install on another host to ensure that each host is compatible for the software you're running. However, it won't show you the name of the actual packages that you need to install. So, if you want to know what PHP packages are installed, you can do the following | With the PHP CLI installed, you can use <code>php -m</code> to get a list of the compiled-in modules for your PHP installation. This is the same as you would find by using the <code>phpinfo();</code> function in a script, except that you get exactly the info you need, in a list format that you can use. That list can show you what you might need to install on another host to ensure that each host is compatible for the software you're running. However, it won't show you the name of the actual packages that you need to install. So, if you want to know what PHP packages are installed, you can do the following | ||
< | <syntaxhighlight lang="bash"> | ||
# On system A, get a list of the php packages that are installed | # On system A, get a list of the php packages that are installed | ||
## apt-based package manager: Debian, Ubuntu | ## apt-based package manager: Debian, Ubuntu | ||
| Line 70: | Line 70: | ||
# On system B, install those packages | # On system B, install those packages | ||
sudo apt-get install [LIST FROM A] | sudo apt-get install [LIST FROM A] | ||
</ | </syntaxhighlight> | ||
If system A and system B use different package managers, then the best you can do is get the list of the modules from each system and compare them. In our <code>diff</code>, we'll use the system we're moving from on the left, because <code>diff</code> is quirky and will show lines that 'differ' with a pipe symbol; thus it's less error-prone to print the first column with awk. | If system A and system B use different package managers, then the best you can do is get the list of the modules from each system and compare them. In our <code>diff</code>, we'll use the system we're moving from on the left, because <code>diff</code> is quirky and will show lines that 'differ' with a pipe symbol; thus it's less error-prone to print the first column with awk. | ||
< | <syntaxhighlight lang="bash"> | ||
A=webfaction.php.modules.txt | A=webfaction.php.modules.txt | ||
| Line 78: | Line 78: | ||
diff --suppress-common-lines --side-by-side $A $B | diff --suppress-common-lines --side-by-side $A $B | ||
</ | </syntaxhighlight> | ||
It's not perfect, but now we have a good list of the modules to search and install. | It's not perfect, but now we have a good list of the modules to search and install. | ||
<pre> | <pre> | ||
| Line 114: | Line 114: | ||
See what's available on our new host. (repositories are different) | See what's available on our new host. (repositories are different) | ||
< | <syntaxhighlight lang="bash"> | ||
apt-cache search php5- | apt-cache search php5- | ||
</ | </syntaxhighlight> | ||
<pre> | <pre> | ||
| Line 185: | Line 185: | ||
And thus, our install | And thus, our install | ||
< | <syntaxhighlight lang="bash"> | ||
sudo apt-get install php5-curl php5-gd php5-gmp php5-imap php5-intl php5-ldap php5-mcrypt php5-memcache php5-mysqlnd php5-pgsql php5-pspell php5-sqlite php5-tidy php5-xmlrpc php5-xsl | sudo apt-get install php5-curl php5-gd php5-gmp php5-imap php5-intl php5-ldap php5-mcrypt php5-memcache php5-mysqlnd php5-pgsql php5-pspell php5-sqlite php5-tidy php5-xmlrpc php5-xsl | ||
</ | </syntaxhighlight> | ||
[[Category:Howto]] | [[Category:Howto]] | ||