<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>ubuntu server configuration on random thoughts</title><link>https://awesomeprogrammer.com/categories/ubuntu-server-configuration/</link><description>Recent content in ubuntu server configuration on random thoughts</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 01 Sep 2012 00:00:00 +0000</lastBuildDate><atom:link href="https://awesomeprogrammer.com/categories/ubuntu-server-configuration/index.xml" rel="self" type="application/rss+xml"/><item><title>Setting up Ubuntu 12.04 Web Server</title><link>https://awesomeprogrammer.com/blog/2012/09/01/setting-up-ubuntu-12-dot-04-web-server/</link><pubDate>Sat, 01 Sep 2012 00:00:00 +0000</pubDate><guid>https://awesomeprogrammer.com/blog/2012/09/01/setting-up-ubuntu-12-dot-04-web-server/</guid><description><![CDATA[<p>Last week I&rsquo;ve got a brand new server to play with ;). The mission was clear (<em>I&rsquo;m going over there, I&rsquo;m going to do the mission&hellip;</em>) - upgrade, install all essential stuff, prepare and migrate the data from the old machine. So here&rsquo;s what I&rsquo;ve done so far (except setting up system accounts, ssh access and all that basic stuff).</p>
<ul>
<li>
<p>installed fresh Apache &amp; PHP from ubuntu repositories - I&rsquo;m aware it&rsquo;s not 100% up to date, but - it&rsquo;s stable, and I didn&rsquo;t want to go as war as PHP 5.4 as it&rsquo;s breaks a lot of stuff with existing applications (and I didn&rsquo;t had time to fix it all on my own), also lack of Suhosin patch for 5.4 is a little bit disappointing (well - it&rsquo;s available but it&rsquo;s still a development version)</p>
</li>
<li>
<p><a href="http://httpd.apache.org/docs/2.2/programs/rotatelogs.html">rotated logs in apache</a> for most sites, as they can get out of control sometimes and cause slowdowns</p>
</li>
<li>
<p>moved some of simple cronjobs tasks that involved only some mysql deletes/updates into <a href="http://dev.mysql.com/doc/refman/5.1/en/events.html">MySQL events</a></p>
</li>
<li>
<p>installed RVM with Ruby 1.9.3 (with standalone passanger that handled legacy 1.8.7/Rails2 apps - with weird dependencies, hacked gems and lack of tests - trust me, it wasn&rsquo;t pleasant ride). Tip: remember to enable and configure all essential proxy modules under apache, and keep an eye on your gemsets so you don&rsquo;t mix it during the process.</p>
</li>
<li>
<p>updated some database backup scripts</p>
</li>
<li>
<p>configured monit to make sure that everything is running smoothly and without interruptions. Monit is a great (and free!) tool by the way - be sure to <a href="http://mmonit.com/monit/">check it out</a>. You can also buy a license for M/Monit which is monit on steroids.</p>
</li>
<li>
<p>and here quick way to dump MySQL tables that you need from old server to the new one:</p>
</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>mysqldump --add-drop-database --add-drop-table --extended-insert --quick --create-options --log-error<span style="color:#f92672">=</span>dump_error.log --user<span style="color:#f92672">=</span>USER --password<span style="color:#f92672">=</span>PASSWORD --databases database1 database2 database3 | pv | ssh -C login@newserver <span style="color:#e6db74">&#34;mysql --user=USER --password=PASSWORD&#34;</span>
</span></span></code></pre></div><p>You execute this command on old server, pipe it to <code>pv</code> (for some neat progress bar) and then to the new server. Here description of options I decided to go with (tweak it as you please for your needs):</p>
<p><code>--add-drop-table</code>
Add a DROP TABLE statement before each CREATE TABLE statement.</p>
<p><code>--add-drop-database</code>
Add a DROP DATABASE statement before each CREATE DATABASE statement. This option is typically used in conjunction with the &ndash;all-databases or &ndash;databases option because no CREATE DATABASE statements are written unless one of those options is specified.</p>
<p><code>--databases</code>
Dump several databases. Normally, mysqldump treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names. CREATE DATABASE and USE statements are included in the output before each new database.</p>
<p><code>--extended-insert</code>
Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.</p>
<p><code>--log-error=file_name</code>
Log warnings and errors by appending them to the named file. The default is to do no logging.</p>
<p><code>--quick</code>
This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out (this may be already set as default in your my.cfg file).</p>
<p><code>--create-options</code>
Include all MySQL-specific table options in the CREATE TABLE statements.</p>]]></description><content:encoded><![CDATA[<p>Last week I&rsquo;ve got a brand new server to play with ;). The mission was clear (<em>I&rsquo;m going over there, I&rsquo;m going to do the mission&hellip;</em>) - upgrade, install all essential stuff, prepare and migrate the data from the old machine. So here&rsquo;s what I&rsquo;ve done so far (except setting up system accounts, ssh access and all that basic stuff).</p>
<ul>
<li>
<p>installed fresh Apache &amp; PHP from ubuntu repositories - I&rsquo;m aware it&rsquo;s not 100% up to date, but - it&rsquo;s stable, and I didn&rsquo;t want to go as war as PHP 5.4 as it&rsquo;s breaks a lot of stuff with existing applications (and I didn&rsquo;t had time to fix it all on my own), also lack of Suhosin patch for 5.4 is a little bit disappointing (well - it&rsquo;s available but it&rsquo;s still a development version)</p>
</li>
<li>
<p><a href="http://httpd.apache.org/docs/2.2/programs/rotatelogs.html">rotated logs in apache</a> for most sites, as they can get out of control sometimes and cause slowdowns</p>
</li>
<li>
<p>moved some of simple cronjobs tasks that involved only some mysql deletes/updates into <a href="http://dev.mysql.com/doc/refman/5.1/en/events.html">MySQL events</a></p>
</li>
<li>
<p>installed RVM with Ruby 1.9.3 (with standalone passanger that handled legacy 1.8.7/Rails2 apps - with weird dependencies, hacked gems and lack of tests - trust me, it wasn&rsquo;t pleasant ride). Tip: remember to enable and configure all essential proxy modules under apache, and keep an eye on your gemsets so you don&rsquo;t mix it during the process.</p>
</li>
<li>
<p>updated some database backup scripts</p>
</li>
<li>
<p>configured monit to make sure that everything is running smoothly and without interruptions. Monit is a great (and free!) tool by the way - be sure to <a href="http://mmonit.com/monit/">check it out</a>. You can also buy a license for M/Monit which is monit on steroids.</p>
</li>
<li>
<p>and here quick way to dump MySQL tables that you need from old server to the new one:</p>
</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>mysqldump --add-drop-database --add-drop-table --extended-insert --quick --create-options --log-error<span style="color:#f92672">=</span>dump_error.log --user<span style="color:#f92672">=</span>USER --password<span style="color:#f92672">=</span>PASSWORD --databases database1 database2 database3 | pv | ssh -C login@newserver <span style="color:#e6db74">&#34;mysql --user=USER --password=PASSWORD&#34;</span>
</span></span></code></pre></div><p>You execute this command on old server, pipe it to <code>pv</code> (for some neat progress bar) and then to the new server. Here description of options I decided to go with (tweak it as you please for your needs):</p>
<p><code>--add-drop-table</code>
Add a DROP TABLE statement before each CREATE TABLE statement.</p>
<p><code>--add-drop-database</code>
Add a DROP DATABASE statement before each CREATE DATABASE statement. This option is typically used in conjunction with the &ndash;all-databases or &ndash;databases option because no CREATE DATABASE statements are written unless one of those options is specified.</p>
<p><code>--databases</code>
Dump several databases. Normally, mysqldump treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names. CREATE DATABASE and USE statements are included in the output before each new database.</p>
<p><code>--extended-insert</code>
Use multiple-row INSERT syntax that include several VALUES lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.</p>
<p><code>--log-error=file_name</code>
Log warnings and errors by appending them to the named file. The default is to do no logging.</p>
<p><code>--quick</code>
This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out (this may be already set as default in your my.cfg file).</p>
<p><code>--create-options</code>
Include all MySQL-specific table options in the CREATE TABLE statements.</p>]]></content:encoded></item></channel></rss>