tag:blogger.com,1999:blog-59452443893224285622024-03-13T02:46:26.053+01:00Dashamir Hoxha - Technical NotesWhen I do something that is not trivial and needs some research, I try to summarize it and write it down, in case that I will need later to do the same thing again. It may also be useful for other people that could be trying to do something similar.Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-5945244389322428562.post-19858722727450503022014-01-24T16:38:00.000+01:002014-01-28T21:15:50.708+01:00Remote Desktop Support With VNC<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
VNC is a well-known tool for remote desktop view and control. The two computers establish a TCP connection so that one of them can access the display of the other. However, almost always these two computers are behind a firewall/router and do not have a real IP to be accessed from the Internet. In such a case one of them can do <b>port forwarding</b> on the router/firewall and this would allow the connection to be established. The problem is that more often than not, none of the parts that want to establish such a remote connection have access to the firewall that separates/protects it from the real internet. Sometimes it can even be several levels deep behind the firewall (several layers of firewalls). However, if you have access to an external server (for example a server in the cloud) there is still a workaround and things can be fixed to work. Here I will explain the tricks and hacks that can be used in such a case in order to establish a secure connection to a remote desktop.</div>
<a name='more'></a><br />
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
The Situation</h2>
<div class="outline-text-2" id="text-1">
Let's say that we have a computer <b>A</b> that wants to connect to the desktop of a computer <b>B</b>. Both of them are behind a NAT router/firewall and cannot modify its settings. However both of them can access a third computer <b>C</b> that is somewhere on the cloud and has a real IP.<br />
<br />
It is possible to use <b>C</b> as a redirecter of the traffic, so that both computers <b>A</b> and <b>B</b> can establish a direct (peer-to-peer) connection between them. This is done using the wonderful features for tunneling and port-forwarding of the <b>SSH</b>protocol. What is more, this connection will be encrypted and secure, which is the main feature of the <b>SSH</b> protocol.<br />
<br />
I will describe in the other sections what should be done in each of the computers in order to setup such a connection.<br />
<br /></div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Basic Setup</h2>
<div class="outline-text-2" id="text-2">
On <b>A</b> we need to have a VNC client. Let's install <b>vncviewer</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">sudo apt-get install vncviewer</pre>
On <b>B</b> we need to have a VNC server. Let's install <b>x11vnc</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">sudo apt-get install x11vnc</pre>
To connect from <b>A</b> to <b>C</b> and from <b>B</b> to <b>C</b> we can use any existing account on <b>C</b>. However it is better to create a new one. Let's call it <b>vnc</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">sudo adduser vnc</pre>
Let's assume that there is a <b>sshd</b> server running on <b>C</b> (otherwise there is no way to access it), and let's say that it is running on the port <b>2201</b>. We will refer to it as <b>middle-server</b> (which can be an IP or a domain name).<br />
<br />
To access the desktop of <b>B</b> from <b>A</b>, we first start the VNC server on <b>B</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">ssh -p 2201 -t -R 5933:localhost:5900 vnc@middle-server
x11vnc -rfbport 5900 -localhost</pre>
Then we start the VNC viewer on <b>A</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">ssh -p 2201 -t -L 5900:localhost:5933 vnc@middle-server
vncviewer -encodings "copyrect tight zrle hextile" localhost:0</pre>
<b>Note:</b> In both cases above, the <b>ssh</b> command and the other command are given on separate terminal tabs. The <b>ssh </b>command creates a ssh tunnel to <b>C</b> for the VNC port 5900, which is mapped to the port 5933 on <b>C</b>.<br />
<br />
Now we can enjoy the access to the remote desktop.<br />
<br /></div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Using A Private-Public Key Pair For The Ssh Connections</h2>
<div class="outline-text-2" id="text-3">
The <b>SSH</b> protocol allows authentication by a private-publik key pair. This would be more convenient because this way we don't have to remember the passsword. Also we can restrict the ssh access only for what we need it: tunneling and port-forwarding, and prohibit login etc.<br />
<br />
Let's create a private-public key pair for user <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">vnc</code> on <b>C</b>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">su - vnc
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ls -al .ssh
total 16
drwx------ 2 vnc vnc 4096 Jan 22 09:31 .
drwxr-xr-x 3 vnc vnc 4096 Jan 22 09:31 ..
-rw------- 1 vnc vnc 1675 Jan 22 09:31 id_rsa
-rw-r--r-- 1 vnc vnc 394 Jan 22 09:31 id_rsa.pub</pre>
The public key <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">id_rsa.pub</code> should go to the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">authorized_keys</code>, and the private key <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">id_rsa</code> will be used by <b>A</b> and <b>B</b> to login:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd ~/.ssh/
cp id_rsa.pub authorized_keys
cp id_rsa vnc.key</pre>
Now we can copy <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">vnc.key</code> to <b>A</b> and <b>B</b> and then run the commands like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">On B:
ssh -p 2201 -t -R 5933:localhost:5900 -i vnc.key vnc@middle-server
x11vnc -rfbport 5900 -localhost
On A:
ssh -p 2201 -t -L 5900:localhost:5933 -i vnc.key vnc@middle-server
vncviewer -encodings "copyrect tight zrle hextile" localhost:0</pre>
This time no password will be asked for establishing the ssh connection.<br />
<br /></div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Making It More Secure</h2>
<div class="outline-text-2" id="text-4">
When we run the <b>ssh</b> command, by default it opens a shell on <b>C</b> where you can run commands, besides creating a tunnel and doing port-forwarding. Even if the <b>vnc</b> account that we use for this purpose may have limited access rights on <b>C</b>, this still is a potential threat (security problem), especially if we don't know or cannot trust the person that is sharing the desktop.<br />
<br />
Fortunately, it is possible to limit the SSH features that each key can use. We do this by modifying the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">authorized_keys</code>to look like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">command="/bin/sleep 4294967295",no-agent-forwarding,no-user-rc,
no-X11-forwarding,permitopen="localhost:5933" ssh-rsa B3NzaC1...</pre>
The long list of no-xyz statements disallow it from doing just about anything except connect to a VNC server.<br />
<br /></div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Referencies</h2>
<div class="outline-text-2" id="text-5">
<ul>
<li><a href="http://blog.markloiseau.com/2012/03/vnc-current-session/">http://blog.markloiseau.com/2012/03/vnc-current-session/</a></li>
<li><a href="https://help.ubuntu.com/community/VNC" style="color: #113399; padding: 1px; text-decoration: none;">https://help.ubuntu.com/community/VNC</a></li>
<li><a href="http://www.karlrunge.com/x11vnc/faq.html" style="color: #113399; padding: 1px; text-decoration: none;">http://www.karlrunge.com/x11vnc/faq.html</a></li>
</ul>
</div>
</div>
<div id="postamble" style="color: #888888; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px;">
<div class="author" style="padding: 0px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #888888; padding: 1px; text-decoration: none;"><dashohoxha gmail.com=""></dashohoxha></a></div>
<div class="date" style="padding: 0px;">
Date: 22 January 2014</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-59020748422526918882013-12-08T00:25:00.000+01:002013-12-08T00:25:05.188+01:00Visualization with gourse<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
Recently I made <a href="http://www.youtube.com/watch?v=qNCbEVVasto" style="color: #113399; padding: 1px; text-decoration: none;">this visualization</a> for contributors to <a href="https://l10n.org.al/" style="color: #113399; padding: 1px; text-decoration: none;">https://l10n.org.al</a> for the last two years (2012-2013). This visualization was done with <a href="https://code.google.com/p/gource/" style="color: #113399; padding: 1px; text-decoration: none;">gource</a>. It was a bit of hacking, so I would like to describe here how I did it.</div>
<a name='more'></a><br />
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Getting The Data To Be Visualized</h2>
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<div class="outline-2" id="outline-container-1" style="color: black; font-size: 16px; font-weight: normal; text-transform: none;">
<div class="outline-text-2" id="text-1">
For each translation or vote on <a href="https://l10n.org.al/" style="color: #113399; padding: 1px; text-decoration: none;">https://l10n.org.al/</a> the time and the name of the author is saved as well. So, we would like to get this information from the database, as well as the project to which this translation belonged, for all votes and translations.<br />
First have a look at this diagram, just to get an idea of the structure of the database:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://raw.github.com/dashohoxha/B-Translator/master/docs/uml/db_diagram.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="433" src="https://raw.github.com/dashohoxha/B-Translator/master/docs/uml/db_diagram.png" width="640" /></a></div>
<br />
Then look at the script below which I used to extract the data.<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#!/bin/bash
query="
SELECT v.time, u.name, (v.time=t.time) AS new, project, origin
FROM votes v
LEFT JOIN users u ON (u.ulng = v.ulng AND u.umail = v.umail)
LEFT JOIN translations t ON (t.tguid = v.tguid)
LEFT JOIN strings s ON (s.sguid = t.sguid)
LEFT JOIN locations l ON (l.sguid = s.sguid)
LEFT JOIN templates tpl ON (tpl.potid = l.potid)
LEFT JOIN projects p ON (p.pguid = tpl.pguid)
"
mysql -u root -D btranslator_data -B -e "$query" > contrib.txt
</pre>
This is simply a join of the tables and extracting the fields that are needed. When the time of vote is the same as the time of translation, then this is a new translation and the field <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">new</code> is true.</div>
</div>
</h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Transforming Data To The Right Format</h2>
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<div class="outline-2" id="outline-container-2" style="color: black; font-size: 16px; font-weight: normal; text-transform: none;">
<div class="outline-text-2" id="text-2">
In the result file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">contrib.txt</code> fields are separated by TAB, so first I replaced tabs with commas (,) for easy processing. I did it with find/replace on Emacs, but any other editor can do this.<br />
Gource expects the input file (which is called log file) in the format <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">timestamp|username|action|filename</code>. Gource was designed to work with version control systems (like git, subversion, etc.) in order to visualize the project activity, so the<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">action</code> is expected to be A, or M, or D etc. (respectively for adding, modifying, deleting a file) and <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">filename</code> is the file that was touched.<br />
I had to transform the data to this format and I did it with a script like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#!/bin/bash
while read l
do
time=$(echo $l | cut -d, -f1)
name=$(echo $l | cut -d, -f2)
new=$(echo $l | cut -d, -f3)
project=$(echo $l | cut -d, -f4)
origin=$(echo $l | cut -d, -f5)
timestamp=$(date -d "$time" +%s) # convert to timestamp
if [ "$new" = "1" ]; then action='A'; else action='M'; fi
path="/$origin/$project"
echo "$timestamp|$name|$action|$path"
done < contrib.txt > contrib.log
</pre>
I also made sure that there are no lines containing NULL and that the file is sorted in increasing order by the timestamp:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">sed -i contrib.log -e '/NULL/d'
sort -t'|' -k1 contrib.log > contrib-1.log
rm contrib.log
mv contrib-1.log contrib.log
</pre>
</div>
</div>
</h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Feeding The Data To Gource And Generating The Output</h2>
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<div class="outline-2" id="outline-container-3" style="color: black; font-size: 16px; font-weight: normal; text-transform: none;">
<div class="outline-text-2" id="text-3">
First make sure that the tools that we need are installed:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">sudo apt-get install gource ffmpeg
</pre>
Then generate the video with a script like this:<br />
<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#!/bin/bash
gource contrib.log -s 0.1 -i 0 --max-files 0 \
--date-format "%B %Y" --hide dirnames,filenames \
-640x360 -o - \
| ffmpeg -y -r 25 -f image2pipe -vcodec ppm -i - \
-vcodec libvpx -b 10000K contrib.webm</pre>
How did I know that these are the right options? I didn't know (especially for <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">ffmpeg</code>), I simply googled and found some examples, then I played with some options of <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">gource</code> in order to get it right.<br />
<br /></div>
</div>
<div id="postamble" style="color: #888888; font-size: 13px; font-weight: normal; margin: 0px; padding: 0px; text-transform: none;">
<div class="author" style="padding: 0px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #888888; padding: 1px; text-decoration: none;"><dashohoxha gmail.com=""></dashohoxha></a></div>
<div class="date" style="padding: 0px;">
Date: 08 December 2013</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
</h2>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-60611390564542536492013-07-18T12:31:00.000+02:002013-07-18T12:31:57.995+02:00Cloning a B-Translator Server<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
Why do I need to clone a <a href="http://info.btranslator.org/" style="color: #113399; padding: 1px; text-decoration: none;">B-Translator</a> server? An obvious reason is to have a backup server. In case that something goes wrong with the main server I can quickly switch to the backup server, until I find and fix the problem.</div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<br /></div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
A clone can also be used for testing. Before applying something on the main server I can test it first on a clone/backup server.</div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<br /></div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
Another reason for cloning can be load-balancing. It is possible to keep several clone servers synchronised with each-other, and then the work can be shared between them with a load balancer. I haven't tried this yet, but I think that it should work.</div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<br /></div>
<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
It can be possible and even simple to make identical clones just by copying the physical disk or the filesystem. However I prefer to build a new server from scratch and copy only the relevant data from the old server.</div>
<a name='more'></a><br />
<div id="table-of-contents" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; margin: 1em 0px; padding: 0.1em;">
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Table Of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><span style="color: #113399;"><span style="padding: 1px;">Installation</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Setting the domain name</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Replacing NGINX with Apache2</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Enable other drupal features</span></span><ul>
<li><span style="color: #113399;"><span style="padding: 1px;">Enable the feature btranslator_fb</span></span></li>
</ul>
</li>
<li><span style="color: #113399;"><span style="padding: 1px;">Start ssh</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Reset the password of drupal admin</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Transfer content</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Fix path aliases and menus</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Transfer drupal private settings</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Get and import PO files</span></span><ul>
<li><span style="color: #113399;"><span style="padding: 1px;">Download (get) PO files</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Import PO files</span></span></li>
</ul>
</li>
<li><span style="color: #113399;"><span style="padding: 1px;">Sync vocabulary data</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Sync users and contributions</span></span></li>
<li><span style="color: #113399;"><span style="padding: 1px;">Switching to the new server</span></span></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Installation</h2>
<div class="outline-text-2" id="text-1">
First, I build a new server from scratch:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">mkdir /var/chroot
cd /var/chroot/
git clone https://github.com/dashohoxha/B-Translator.git
nohup nice B-Translator/install/install.sh btr-1 &
tail -f nohup.out
</pre>
Then configure it:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot btr-1/ /tmp/install/config.sh
</pre>
And then reboot the host:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">reboot ## it is advisable to reboot the host after this installation
</pre>
The last step of configuration is about setting the primary language of translation (<b>sq</b> in my case), and a list of auxiliary languages. This list should include at least <b>fr</b>, since it is used instead of POT (PO template) files, when they are missing. But the features related to auxiliary languages are not implemented yet, so it is not much useful to include other languages on that list, and I leave just <b>fr</b>.</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Setting The Domain Name</h2>
<div class="outline-text-2" id="text-2">
If I can assign a domain name to this copy of B-Translator (for example <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">test.l10n.org.al</code>), but during the configuration it is not given properly, then I can correct/change it like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr-1
cd /var/www/btranslator/profiles/btranslator
install/config/domain.sh
</pre>
If this is a local copy (installed on my local machine) and its domain name is for example <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">l10n.org.xy</code>, then I also add this domain name on the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/hosts</code> of my machine:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">127.0.0.1 l10n.org.xy localhost
</pre>
This way I can access it by typing <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">https://l10n.org.xy</code> on the browser location (not <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">https://127.0.0.1</code> or<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">https://localhost</code>).</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Replacing NGINX With Apache2</h2>
<div class="outline-text-2" id="text-3">
I have used NGINX as the default web server because it is supposed to be faster and more responsive under heavy load. Unfortunately it has been working very slow, for some reasons that I have not been able to find and fix. On the log file<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/log/nginx/btranslator.error.log</code> I see messages like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">2013/07/15 13:31:57 [info] 10294#0: *47 client closed prematurely connection while SSL handshaking, client: 127.0.0.1, server: l10n.org.xx
2013/07/15 13:31:57 [info] 10294#0: *48 client closed prematurely connection while SSL handshaking, client: 127.0.0.1, server: l10n.org.xx
</pre>
<b>Note:</b> If find out what is wrong with NGINX and manage to fix it, please let me know.<br />
So, I replace NGINX with Apache2 like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr-1
cd /var/www/btranslator/profiles/btranslator
dev/apache2.sh start
</pre>
It will stop services <i>nginx</i>, <i>php5-fpm</i> and <i>memcached</i>, will start <i>apache2</i>, will disable drupal module <i>memcache</i>, and will modify properly <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">settings.php</code>.<br />
<br />
However there are also some changes outside <i>chroot</i> that should be done. The script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/apache2.sh start</code> cannot do them automatically (because it runs inside the chroot), so I have to do them manually. On the init script<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/init.d/chroot-btr-1</code> I make this change:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#CHROOT_SERVICES="cron php5-fpm memcached mysql nginx"
CHROOT_SERVICES="cron mysql apache2"
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Enable Other Drupal Features</h2>
<div class="outline-text-2" id="text-4">
After installation I also enable some features that are optional and are not enabled by default during installation:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush features-list
drush --yes pm-enable btranslator_simplenews
drush --yes pm-enable btranslator_mass_contact
## drush --yes pm-enable btranslator_googleanalytics
## drush --yes pm-enable btranslator_drupalchat
## drush --yes pm-enable btranslator_janrain
</pre>
</div>
<div class="outline-3" id="outline-container-4.1">
<h3 id="sec-4.1" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
<br /></h3>
<h3 id="sec-4.1" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
Enable The Feature Btranslator_fb</h3>
<div class="outline-text-3" id="text-4.1">
<b>Note:</b> The feature <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">btranslator_fb</code> is not yet finished and tested properly.<br />
Enable it like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">## drush --yes pm-enable btranslator_fb
</pre>
After installing <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">btranslator_fb</code>, the configuration part related to FB should be un-commented, at the end of the file<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator/sites/default/settings.php</code>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">// /* fb config
$conf['fb_api_file'] = 'profiles/btranslator/libraries/facebook-php-sdk/src/facebook.php';
include "profiles/btranslator/modules/contrib/fb/fb_url_rewrite.inc";
include "profiles/btranslator/modules/contrib/fb/fb_settings.inc";
if (!headers_sent()) {
header('P3P: CP="We do not have a P3P policy."');
}
// fb config */
</pre>
If you forget to do it, you will notice performance degrade with the site.</div>
</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Start Ssh</h2>
<div class="outline-text-2" id="text-5">
If this copy of B-Translator is remote, then I install <b>ssh</b> as well for accessing it easily and for using remote drush commands:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr-1
cd /var/www/btranslator/profiles/btranslator
dev/install-sshd.sh
</pre>
This script will also take care to change the ssh port to <b>2201</b>, in order to avoid any conflicts with any existing daemon on the host environment, and also for increased security.<br />
<br />
For drush remote access to work correctly, the public/private key ssh access should be set up and configured as well. For more detailed instructions on how to do it see: <a href="http://dashohoxha.blogspot.com/2012/08/how-to-secure-ubuntu-server.html" style="color: #113399; padding: 1px; text-decoration: none;">http://dashohoxha.blogspot.com/2012/08/how-to-secure-ubuntu-server.html</a></div>
</div>
<div class="outline-2" id="outline-container-6" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Reset The Password Of Drupal Admin</h2>
<div class="outline-text-2" id="text-6">
I almost always forget the password of <b>admin</b> (the primary user of Drupal) that I assign during installation. So, I have to reset it:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush user-password admin --password="new-password"
</pre>
By the way, on the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/drush/drushrc.php</code> you can see this drush setting:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">// by default use the B-Translator root directory
$options['r'] = '/var/www/btranslator';
</pre>
This means that the root directory of <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">drush</code> is always <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator</code>, no matter where we call it from.</div>
</div>
<div class="outline-2" id="outline-container-7" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-7" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-7" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Transfer Content</h2>
<div class="outline-text-2" id="text-7">
On the master (main/live) server, I export all the content as a feature, with the help of the module <b>node_export</b>. But first I have to disable the existing <b>btranslator_content</b> feature, otherwise the feature export will fail.<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush --yes pm-disable btranslator_content
drush --yes features-export --destination=/tmp btranslator_content_1 node_export_features
tar --create --gzip --file=btranslator_content_1.tgz --directory=/tmp btranslator_content_1
</pre>
Now I transfer <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">btranslator_content_1.tgz</code> to the clone server and replace the existing content with it:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator/profiles/btranslator
cd modules/features/
tar --extract --gunzip --file=btranslator_content_1.tgz
drush --yes pm-disable btranslator_content
drush delete-all all ## delete all existing nodes
drush --yes pm-enable btranslator_content_1
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-8" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-8" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-8" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Fix Path Aliases And Menus</h2>
<div class="outline-text-2" id="text-8">
Path aliases and some menus have to be fixed (recreated) manually. I couldn't find any modules, drush commands or scripts that can transfer them automatically. If you know any tricks to export/import them automatically, please let me know.<br />
<br />
I transfer manually the configuration of the Homebox as well. I open <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">admin/structure/homebox</code> on both sites (the main and the clone), export the configuration of 'dashboard' from the main, then copy/paste and import it on the clone.</div>
</div>
<div class="outline-2" id="outline-container-9" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-9" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-9" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Transfer Drupal Private Settings</h2>
<div class="outline-text-2" id="text-9">
Private settings are those variables that are site specific and cannot be included in features, for example: <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">disqus_domain</code>,<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">disqus_userapikey</code>, <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">disqus_publickey</code>, <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">disqus_secretkey</code>, etc.<br />
We can transfer them like this:<br />
<ul>
<li>Save them on the main site:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator/profiles/btranslator
modules/features/save-private-vars.sh
</pre>
It will generate the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">restore-private-vars.php</code>.</li>
<li>Transfer <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">restore-private-vars.php</code> to the clone site and then apply it like this:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush php-script restore-private-vars.php
</pre>
</li>
</ul>
<b>Note:</b> If the clone site will be used for testing, you may consider to edit manually the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">restore-private-vars.php</code>, before applying it, and change some values. For example, I usually change email addresses from <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">info@l10n.org.al</code> to<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">info+test@l10n.org.al</code>. I also enable email rerouting by changing these variables:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">$variables['reroute_email_enable'] = 1;
$variables['reroute_email_enable_message'] = 1;
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-10" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-10" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-10" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Get And Import PO Files</h2>
<div class="outline-text-2" id="text-10">
The database of translations is almost empty (it has only the PO files that were imported for testing during installation). Downloading and importing all the PO files is easy (but it takes a long time).</div>
<div class="outline-3" id="outline-container-10.1">
<h3 id="sec-10.1" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
<br /></h3>
<h3 id="sec-10.1" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
Download (Get) PO Files</h3>
<div class="outline-text-3" id="text-10.1">
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
nohup nice get/all.sh &
tail -f nohup.out
or
cd get/
./gnome.sh
./kde.sh
./firefox-os.sh
./drupal.sh
./office.sh
./mozilla.sh
./wordpress.sh
./ubuntu.sh
</pre>
<b>Note:</b> These scripts get the data from some URL. They should be checked first, to make sure that the URL still works or that we are getting the latest version.<br />
<br />
<b>Note:</b> Make sure that <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">hostname</code> is listed on <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/hosts</code> otherwise the command <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">svn checkout</code> will not work (strange, but that's how it is). For example if the output of the command <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">hostname</code> is <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dashamir</code>, then <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/hosts</code> should look like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">127.0.0.1 l10n.org.xx localhost dashamir
</pre>
</div>
</div>
<div class="outline-3" id="outline-container-10.2">
<h3 id="sec-10.2" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
<br /></h3>
<h3 id="sec-10.2" style="border-bottom-color: rgb(238, 238, 238); border-bottom-style: solid; border-bottom-width: 1px; color: #992222; font-size: 1.2em; text-transform: capitalize;">
Import PO Files</h3>
<div class="outline-text-3" id="text-10.2">
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
nohup nice import/all.sh &
tail -f nohup.out
</pre>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-11" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-11" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-11" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Sync Vocabulary Data</h2>
<div class="outline-text-2" id="text-11">
Vocabulary is a pseudo-project, its PO file does not really belong to the translation of any program. I use it to collect interesting terms and translations that I encounter while translating the other projects. It can help as a reminder (in case that I forget the translation of a term). It is also useful for discussing translations of difficult terms with other people, and indirectly it helps to ensure consistency among the translations. Terms are added to vocabulary by the translators. In order to transfer them from one instance of B-Translator to another, it can be exported as a PO file on one system and imported to the other.<br />
<ul>
<li>Export <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">vocabulary-sq.po</code>:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
export/export.sh misc vocabulary sq $(pwd)/tmp
mv tmp/vocabulary/vocabulary-sq.po .
rm -rf tmp
</pre>
</li>
<li>Transfer <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">vocabulary-sq.po</code> to the other system and them import it:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
mv vocabulary-sq.po vocabulary/
import/vocabulary.sh
</pre>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-12" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-12" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-12" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Sync Users And Contributions</h2>
<div class="outline-text-2" id="text-12">
Now the cloned site is almost identical with the primary site in terms of Drupal settings and configuration and in terms of translation data (projects that are imported, strings and their translations, etc.). What is still missing is the list of users that are registered on the primary site, as well as their contributions (votes and suggested translations).<br />
We can transfer them like this:<br />
<ul>
<li>Export them on the primary site:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
db/export-users.sh
db/export-contributions.sh
</pre>
</li>
<li>Transfer <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">*.sql.gz</code> files to the clone site and import them:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_data
db/import-users.sh users-20130717.sql.gz
db/import-contributions.sh contributions-00000000-20130717.sql.gz
</pre>
</li>
</ul>
<b>Note:</b> Once you have transferred all the users, the clone site will send them daily a string for review, in addition to the one that is sent by the primary site. We can prevent this by disabling the cron. Edit the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/cron.d/drupal7</code> and comment the line that starts the cron.</div>
</div>
<div class="outline-2" id="outline-container-13" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-13" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-13" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Switching To The New Server</h2>
<div class="outline-text-2" id="text-13">
Suppose that I want to make the cloned server primary. In this case there are some steps that should be done:<br />
<ul>
<li>Transfer GoogleApps verification files. I use GoogleApps for email accounts etc. (it offers 10 email accounts for free). To verify that I own this domain, GoogleApps requests me to put a certain file on the root of my webserver. This file looks like <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">google9350a51ac2d503bf.html</code> and I place it on <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator</code>.</li>
<li>Transfer SSL certificates. I have obtained a free SSL certificate for my site (see:<a href="http://arstechnica.com/security/2009/12/how-to-get-set-with-a-secure-sertificate-for-free/" style="color: #113399; padding: 1px; text-decoration: none;">http://arstechnica.com/security/2009/12/how-to-get-set-with-a-secure-sertificate-for-free/</a>). The configuration on<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/nginx/sites-available/default</code> looks like this:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">ssl_certificate /etc/ssl/certs/ssl-cert-l10n_org_al.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-l10n_org_al.key;
</pre>
The corresponding configuration on <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/apache2/sites-available/default-ssl</code> looks like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">SSLCertificateFile /etc/ssl/certs/ssl-cert-l10n_org_al.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-l10n_org_al.key
</pre>
The files <b>.pem</b> and <b>.key</b> need to be transferred to the new server and the configuration files of nginx and apache2 should be modified properly.</li>
<li>Enable cron. Since I have disabled cron (on a test site), I have to enable it again by un-commenting it on<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/cron.d/drupal7</code>.</li>
<li>Replace test settings with live settings. Export drupal setting on the main site with <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">modules/features/save-private-vars.sh</code> and then import them on the new site with <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">drush php-script restore-private-vars.php</code>.</li>
<li>On the DNS server I change the record of <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">l10n.org.al</code> to point to the new IP. But the DNS change may take about 2 days to be propagated worldwide. So, after 2-3 days I do again a transfer of users and contributions from the old server to the new one. These transfer operations are designed to be idempotent, which means that the result will be the same even if they are applied many times.</li>
</ul>
</div>
</div>
<div id="postamble" style="color: #888888; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px;">
<div class="author" style="padding: 0px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #888888; padding: 1px; text-decoration: none;"><dashohoxha gmail.com=""></dashohoxha></a></div>
<div class="date" style="padding: 0px;">
Date: 2013-07-18 11:47:36 CEST</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-31284788911765578742013-07-12T06:54:00.000+02:002013-07-12T06:54:39.154+02:00Easy Blogging With Emacs<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
Time after time I write technical blogs and articles that describe and summarise my experiences. Nowadays all the blogging sites and tools offer WYSIWYG editors. And it makes blogging so easy, right? Not for me! I always find WYSIWYG editing tedious and frustrating.</div>
<a name='more'></a><br />
<div id="table-of-contents" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; margin: 1em 0px; padding: 0.1em;">
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Table Of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li>Why WYSIWYG sucks</li>
<li>Org-mode of Emacs</li>
<li>Installing Emacs</li>
<li>Using org-mode for writing documents</li>
<li>Publishing the document</li>
<li>Converting the document to PDF</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Why WYSIWYG Sucks</h2>
<div class="outline-text-2" id="text-1">
One reason is that you have to make manually every single change (no styles like CSS for example), which makes the process tedious, error prone and inconsistent. If you decide later to change some styles, you have to go all over the document and modify all occurrences one by one… Oh man, better don't touch it at all!<br />
<br />
But the worst thing about WYSIWYG is that actually its last name is WYGIANWYW (What You Get Is Almost Never What You Want). I have struggled many times with the editor because it would never understand correctly what I wanted and would display a totally broken formatting (long live <b>undo</b> that comes quickly to the rescue).<br />
<br />
So, I'd rather write plain text HTML than use WYSIWYG editing, unless the structure and formatting of the document is very simple. Maybe not everybody finds WYSIWYG so difficult and annoying, but the technical blogs (articles, documents, etc.) that I write are a bit long and with complex structure, and WYSIWYG would never be suitable for me. I have also tried different wiki systems, which in a sense are better than WYSIWYG, but still they are a bit simple and do not support all the features that I need.</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Org-Mode Of Emacs</h2>
<div class="outline-text-2" id="text-2">
After trying different tools and systems, I decided that the <a href="http://orgmode.org/" style="color: #113399; padding: 1px; text-decoration: none;">orgmode</a> of Emacs is the best for my needs. Quoting from its webpage:<br />
<blockquote>
"Org mode is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system."</blockquote>
So, among other things, org-mode can be used for <i>authoring documents</i>, that is writing blogs, articles etc.<br />
<br />
It has a wiki-like syntax that is lightweight but also complex (not-simple). Combined with the editing power of Emacs it becomes a powerful tool for writing blogs, articles and other docs. Then, it can be converted automatically to other formats, like <i>HTML</i>, <i>LaTeX</i>, <i>PDF</i>, etc.<br />
<br />
I will try to describe how I use it for my needs (writing blogs, articles, etc.)</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Installing Emacs</h2>
<div class="outline-text-2" id="text-3">
On Ubuntu it can be installed like this: <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">sudo apt-get install emacs</code> On other Linux systems it should be very easy too. If you are using Windows, then look at the instructions on this <a href="http://www.claremontmckenna.edu/pages/faculty/alee/emacs/emacs.html" style="color: #113399; padding: 1px; text-decoration: none;">page</a>.<br />
<br />
The latest versions of Emacs include org-mode by default, so there is no need to do anything special for installing it. Just use the extension <b>.org</b> for the file and the <i>org editing mode</i> will be enabled automatically.</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Using Org-Mode For Writing Documents</h2>
<div class="outline-text-2" id="text-4">
Emacs is an advanced editing tool and org-mode has lots of features, however not all of them are needed. For what we want to do (writing technical blogs and docs), we need some very basic and simple things.<br />
I will list the ones that I use most frequently:<br />
<ul>
<li>Paragraphs are marked by empty lines:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">Paragraph1
Paragraph1 continued
Paragraph2
Paragraph2 continued
</pre>
</li>
<li>Headings are marked by stars at the beginning of a line:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">* Heading1
** Heading2
*** Heading3
** Heading2
* Heading1
** Heading2
</pre>
</li>
<li>Ordered and unordered lists:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">+ item-1
1. item-1.1
2. item-1.2
3. item-1.3
+ item-2
- item-2.1
- item-2.2
- item-2.3
+ item-3
</pre>
<ul>
<li>item-1<ol>
<li>item-1.1</li>
<li>item-1.2</li>
<li>item-1.3</li>
</ol>
</li>
<li>item-2<ul>
<li>item-2.1</li>
<li>item-2.2</li>
<li>item-2.3</li>
</ul>
</li>
<li>item-3</li>
</ul>
</li>
<li>Inline markup:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">*bold*, /italic/, _underlined_, =code= and ~verbatim~
</pre>
<b>bold</b>, <i>italic</i>, <span style="text-decoration: underline;">underlined</span>, <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">code</code> and <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">verbatim</code></li>
<li>Hyperlink:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">[[http://info.btranslator.org][B-Translator]]
</pre>
<a href="http://info.btranslator.org/" style="color: #113399; padding: 1px; text-decoration: none;">B-Translator</a></li>
<li>Preformatted:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#+BEGIN_EXAMPLE
Some example from a text file.
# +END_EXAMPLE
</pre>
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">Some example from a text file.
</pre>
</li>
</ul>
It is so simple, intuitive and familiar, that you don't even need a tutorial and can start using it right away.<br />
<br />
You can find more about the markup that can be used, on the <a href="http://orgmode.org/org.html#Markup" style="color: #113399; padding: 1px; text-decoration: none;">documentation of org-mode</a> (or try <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">info org</code> on the terminal).<br />
<br />
As an example, you can see the <i>org</i> code of this document itself on gist: <a href="https://gist.github.com/dashohoxha/5981222" style="color: #113399; padding: 1px; text-decoration: none;">easy-blogging-with-emacs.org</a></div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Publishing The Document</h2>
<div class="outline-text-2" id="text-5">
In order to publish the document, I do these steps:<br />
<ol>
<li>First, convert it to HTML (with the emacs command: <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">C-c C-e h</code>).</li>
<li>Then open the generated HTML file in a browser.</li>
<li>And then copy/paste the content of the article from the browser to the editor of the blog site.</li>
</ol>
I don't know why, but a copy/paste like this usually works very well. I use <a href="http://dashohoxha.blogspot.com/" style="color: #113399; padding: 1px; text-decoration: none;">Blogger</a> for my blogs, but I think that it should work on other blog sites and WYSIWYG editors as well.<br />
<br />
After the copy/paste, I still have to do some minor manual corrections, but this is much easier than writing the whole thing on the WYSIWYG editor.<br />
<br />
Pay attention to these lines that are at the beginning of the <i>org</i> file:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#+OPTIONS: num:nil toc:t ^:nil f:nil TeX:nil LaTeX:nil
#+STYLE: <link href="css/org.css" rel="stylesheet" type="text/css"></link>
</pre>
They control the look of the generated HTML file. The first one defines some settings/options, like: don't number headers, generate a TOC, turn off TeX syntax for subscripts, etc. More details and other options you can find on the documentation for <a href="http://orgmode.org/org.html#Export-settings" style="color: #113399; padding: 1px; text-decoration: none;">export settings</a>.<br />
<br />
The second line tells it which CSS file to use, so that the generated HTML looks nice and beautiful. For a quick start, just download and use my <a href="https://gist.github.com/dashohoxha/5980833" style="color: #113399; padding: 1px; text-decoration: none;">org.css</a> file, and later you can customise it for yourself. For example, it defines the style of preformatted text like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">pre {
padding: 10px;
border: 1pt solid #AEBDCC;
border-radius: 5px;
background-color: #000000;
color: #eeeeee;
font-family: Ubuntu Mono, monospace, courier;
}
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-6" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Converting The Document To PDF</h2>
<div class="outline-text-2" id="text-6">
Org-mode can convert directly to PDF. However there is no way (as far as I know) to modify how the generated PDF file looks like. It always has the same standard look of an old scientific paper (I guess that the conversion to PDF is done by converting first to LaTeX).<br />
<br />
I prefer to take another approach for generating PDF docs:<br />
<ol>
<li>First I generate the HTML file (where I can control how it looks by customising the CSS file).</li>
<li>Then I copy/paste from the browser to LibreOffice (yes, this copy/paste works well too, preserving all the formatting and styles from HTML).</li>
<li>Finally save it as PDF. LibreOffice has a built-in PDF converter.</li>
</ol>
However, before the third step I do again some minor manual modifications. I also define styles for headings, preformatted text, text body, etc.<br />
<br />
One of the things that I change in LibreOffice/PDF document is the style of the preformatted text. In the HTML version it is white font on a black background, and this is good because it looks like a terminal. However PDF documents sometimes can be printed and that style doesn't look nice on paper (and also it would consume lots of ink), so I change it to black font on white background.<br />
<br />
To apply the new style on a preformatted text, I select it, then from the list of styles (on top-left) select "Clear formatting", then select the style "Preformatted Text". I have to do this for all the preformatted texts. I do the same thing for headings as well.<br />
<br />
In order to not re-define the styles for each document, I open an old document, replace its content with the new content, and then save it with a new name. This will ensure that the styles of the new document are the same as the styles of the old one. Maybe LibreOffice has some other means for defining the styles and using them on each document, but I am not so familiar with LibreOffice and this trick works anyway.<br />
<br />
If you want to use my styles, you can download the <b>.odt</b> document from <a href="http://academia.edu/4005672/Easy_Blogging_With_Emacs" style="color: #113399; padding: 1px; text-decoration: none;">here</a> and use it as a template for your own docs.<br />
<br /></div>
</div>
<div id="postamble" style="color: #888888; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px;">
<div class="author" style="padding: 0px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #888888; padding: 1px; text-decoration: none;"><dashohoxha gmail.com=""></dashohoxha></a></div>
<div class="date" style="padding: 0px;">
Date: 12 July 2013</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-62149881450238032882013-07-09T18:50:00.000+02:002013-07-09T18:50:49.689+02:00Using Drupal Features In B-Translator<div style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
Features are very useful for building Drupal profiles (re-usable applications). They provide a way to capture and save in code the customizations that are done to a Drupal site/application. Here I will describe how I use them in <a href="http://info.btranslator.org/" style="color: #113399; padding: 1px; text-decoration: none;">B-Translator</a>.</div>
<a name='more'></a><br />
<div id="table-of-contents" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; margin: 1em 0px; padding: 0.1em;">
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Table Of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li>Benefits of using features</li>
<li>Creating features</li>
<li>Customizing features manually</li>
<li>Making features configurable</li>
<li>Saving and restoring private variables</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Benefits Of Using Features</h2>
<div class="outline-text-2" id="text-1">
Some of the main benefits of using features are these:<br />
<ol>
<li>They help the development and maintenance of the application. Customization/configuration changes can be tracked and versioned (for example in git) just like the code of the application.</li>
<li>They help the installation of a new instance of the application. Customizations can be replayed (applied) easily on a new installation of the application, without having to repeat them manually.</li>
<li>They make the application structured (as opposed to monolithic). For example <i>drupalchat</i> is offered as a feature and can be installed very easily by installing the feature. But sites that do not want to use it just don't install that feature.</li>
</ol>
For more details about features (and their features) you can read these blogs:<br />
<ul>
<li><a href="http://scotthadfield.ca/2011/09/21/features-part-2-managing-your-feature" style="color: #113399; padding: 1px; text-decoration: none;">http://scotthadfield.ca/2011/09/21/features-part-2-managing-your-feature</a></li>
<li><a href="http://scotthadfield.ca/2011/09/30/features-part-3-re-usable-features" style="color: #113399; padding: 1px; text-decoration: none;">http://scotthadfield.ca/2011/09/30/features-part-3-re-usable-features</a></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Creating Features</h2>
<div class="outline-text-2" id="text-2">
Features can be created and managed through UI. However I find the UI for creating features not suitable (tedious, sluggish, unreliable), at least when creating features for a Drupal profile. Fortunately they can also be fully managed from the command line (with <b>drush</b>):<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush help --filter=features
</pre>
First of all, we can get a list of all the so called <i>features components</i>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush @dev help features-components
drush @dev features-components '%:%' > features-components.txt
</pre>
These are all the possible chunks of configuration that can be saved in a feature. All we have to do is to search and select the ones that are relevant for the feature that we want to build and then create a feature with these components. This will automatically generate the code (Drupal API) that is necessary to apply these configurations.<br />
<br />
For example, these are the components that I have selected for the <i><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/components/layout" target="_blank">layout</a></i> feature (which is supposed to re-construct automatically the layout and look of a freshly installed B-Translator site):<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">variable:theme_bootstrap1_settings
variable:theme_default
box:headerbox
context:admin
context:content
context:frontpage
context:page
context:sitewide
context:translations
views_view:front_page
variable:site_frontpage
menu_links:main-menu:<front>
menu_links:main-menu:node/9
menu_links:main-menu:translations
menu_links:main-menu:node/1
menu_links:main-menu:contact
menu_custom:navig-menu
menu_links:navig-menu:translations
menu_links:navig-menu:node/9
menu_links:navig-menu:translations/search
menu_links:navig-menu:node/1
menu_links:navig-menu:contact
</front></pre>
These include the theme, blocks layout, the front page view, and the menus.<br />
<br />
Now I can create a feature that includes these components with a command like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush @dev features-export \
--destination=profiles/btranslator/modules/features \
btranslator_layout $(cat layout_components)
</pre>
It creates a feature on the directory: <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator_dev/profiles/btranslator/modules/features/btranslator_layout/</code><br />
<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><br /></code>
Other features that I have created are: <i>btranslator_disqus</i>, <i>btranslator_invite</i>, <i>btranslator_sharethis</i>,<i>btranslator_captcha</i>, <i>btranslator_drupalchat</i>, <i>btranslator_janrain</i>, <i>btranslator_simplenews</i>, <i>btranslator_mass_contact</i>,<i>btranslator_googleanalytics</i>, etc. In order to recreate them easily, the script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">create-features.sh</code> can be used. It will create a feature for each list of components that is on the directory <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/tree/master/modules/features/components" target="_blank">components/</a></code>.<br />
<br />
The file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/create-features.sh" target="_blank">create-features.sh</a></code> has a content like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#!/bin/bash
### Create all the features.
### However some features need manual customization
### after being created (for example btranslator_layout).
drush="drush --yes @dev"
destination="profiles/btranslator/modules/features"
function create_feature
{
components=$1
feature_name="btranslator_$(basename $components)"
xargs --delimiter=$'\n' --arg-file=$components \
$drush features-export --destination=$destination $feature_name
}
### go to the directory of the script
cd $(dirname $0)
### clear cache etc.
$drush cc all
rm -f components/*~
### create a feature for each file in 'components/'
for components in $(ls components/*)
do
echo "===> $components"
create_feature $components
done
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Customizing Features Manually</h2>
<div class="outline-text-2" id="text-3">
A feature is basically just a Drupal module (although it is generated automatically by the command <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">features-export</code>). So, we can further customize it manually if needed. And sometimes there is the need for manual customization because the automatic generation cannot get always everything right. In the case of the layout feature I added the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/btranslator_layout/btranslator_layout.install" target="_blank">btranslator_layout.install</a></code>, which uses <b>hook_enable()</b> to make further customizations after the feature is installed.<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;"> 'Udhëzuesi i Përkthyesit',
'about' => 'About',
);
foreach ($aliases as $alias => $title) {
$query = "SELECT nid FROM {node} WHERE title='$title' AND status=1";
$nid = db_query($query)->fetchField();
if ($nid == FALSE) continue;
$source = "node/$nid";
db_query("DELETE FROM {url_alias} WHERE source='$source' AND alias='$alias'");
$args = array('source' => $source, 'alias' => $alias);
path_save($args);
}
}
function _btranslator_layout_add_login_link() {
$query = "DELETE FROM {menu_links}
WHERE menu_name='user-menu'
AND link_path='user/login'
AND link_title='Login' AND plid='0' ";
db_query($query);
$login = array(
'menu_name' => 'user-menu',
'link_path' => 'user/login',
'link_title' => 'Login',
'plid' => '0',
'router_path' => 'user/login',
);
menu_link_save($login);
}
function _btranslator_layout_block_settings() {
// set the title of the menu block as Navigation
db_query("UPDATE {block} SET title='Navigation'
WHERE theme='bootstrap1' AND delta='navig-menu'");
// remove the title of the block user-menu
db_query("UPDATE {block} SET title='<none>'
WHERE theme='bootstrap1' AND delta='user-menu'");
// disable all the blocks for theme bootstrap1
// their place is managed by module context
db_query("UPDATE {block} SET status = '0' WHERE theme = 'bootstrap1'");
}
</none></pre>
It creates aliases, which cannot be handled properly by the <i>features</i>. It creates a <i>Login</i> menu link, which is not handled propperly by the <i>features</i> (although in general menu links can be handled quite well by the features). It also sets the correct settings for the blocks in a simple way, although there are other ways to handle them by the <i>features</i>.</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Making Features Configurable</h2>
<div class="outline-text-2" id="text-4">
Some of the features are required and will be automatically installed when the (btranslator) profile is installed, and some others are optional and can be installed later by the site administrator, if they wish. Most of these features are closely related to some contrib modules and basically just save default/reasonable values for the configuration settings of the module.<br />
<br />
Some of these modules are just wrappers to external API services, like disqus, sharethis, janrain, recaptcha, googleanalytics, etc. Usually they need some API keys or any other private attributes that are different from site to site. We cannot save these private attributes on the feature, because they are specific for each different site. But we would like to offer the administrator/maintainer of the (B-Translator) application an easy way to manage them, without having to search up and down among a huge number of configuration options available to the Drupal admin. In order to do this, I have customized the automatically generated features, taking advantage of the fact that they are just Drupal modules, and anything that works for Drupal modules works for them too.<br />
<br />
For example, for the feature <i>btranslator_googleanalytics</i>, I have added this line on <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/btranslator_googleanalytics/btranslator_googleanalytics.module" target="_blank">btranslator_googleanalytics.module</a></code>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">include_once 'btranslator_googleanalytics.admin.inc';
</pre>
I have also created the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/btranslator_googleanalytics/btranslator_googleanalytics.admin.inc" target="_blank">btranslator_googleanalytics.admin.inc</a></code> with a content like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;"> 'GoogleAnalytics',
'description' => 'Private GoogleAnalytics settings.',
'page callback' => 'drupal_get_form',
'page arguments' => array('btranslator_googleanalytics_config'),
'access arguments' => array('btranslator-admin'),
);
return $items;
}
/**
* Custom settings for GoogleAnalytics.
*
* @return
* An array containing form items to place on the module settings page.
*/
function btranslator_googleanalytics_config() {
$form = array();
$form['googleanalytics_account'] = array(
'#title' => t('Web Property ID'),
'#type' => 'textfield',
'#default_value' => variable_get('googleanalytics_account', 'UA-'),
'#size' => 15,
'#maxlength' => 20,
'#required' => TRUE,
'#description' => t('This ID is unique to each site you want to track
separately, and is in the form of UA-xxxxxxx-yy.
To get a Web Property ID, <a href="https://www.blogger.com/@analytics">
register your site with Google Analytics</a>,
or if you already have registered your site,
go to your Google Analytics Settings page
to see the ID next to every site profile.
<a href="https://www.blogger.com/@webpropertyid">Find more information
in the documentation</a>.',
array('@analytics' => 'http://www.google.com/analytics/',
'@webpropertyid' => url('https://developers.google.com/analytics/resources/concepts/gaConceptsAccounts',
array('fragment' => 'webProperty')))),
);
return system_settings_form($form);
}
</pre>
It creates a configuration page for GoogleAnalytics under the section of B-Translator configurations. This admin/config page allows the site administrator to set quickly and easily the <i>account ID</i> of GoogleAnalytics. All this is just normal Drupal stuff, which can be done for any Drupal module. Nothing specially related to features. For my convenience, I have copied the definition of the form field from the <i>googleanalytics</i> Drupal module itself (from the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">googleanalytics.abmin.inc</code>).</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Saving And Restoring Private Variables</h2>
<div class="outline-text-2" id="text-5">
If we cannot and should not keep private settings/attributes in features, then there should be some other easy way for the site administrators to backup and restore them, without making them public and available to everyone. This can be done by the script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">save-private-vars.sh</code>. It takes a list of variables from <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">private-vars.txt</code> and creates the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">restore-private-vars.php</code> which keeps the values of these variables and can restore them. It works like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">features/save-private-vars.sh @dev
drush @dev php-script restore-private-vars.php
</pre>
The file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/private-vars.txt" target="_blank">private-vars.txt</a></code> looks like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">disqus_domain
disqus_userapikey
disqus_publickey
disqus_secretkey
sharethis_publisherID
sharethis_twitter_handle
sharethis_twitter_suffix
rpx_apikey
simplenews_from_address
simplenews_test_address
mass_contact_default_sender_email
mass_contact_default_sender_name
recaptcha_private_key
recaptcha_public_key
googleanalytics_account
</pre>
The script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;"><a href="https://github.com/dashohoxha/B-Translator/blob/master/modules/features/save-private-vars.sh" target="_blank">save-private-vars.sh</a></code> has a content like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#!/bin/bash
### Save sensitive/private variables that should not be made public.
echo "Usage: $0 [@drush_alias]"
drush_alias=$1
drush="drush $drush_alias"
cat <<eof> restore-private-vars.php
> restore-private-vars.php
done < $(dirname $0)/private-vars.txt
cat <<eof>> restore-private-vars.php
// set variables
foreach (\$variables as \$var_name => \$var_value) {
variable_set(\$var_name, \$var_value);
}
EOF
echo "
Restore variables with the command:
$drush php-script restore-private-vars.php
"
</eof></eof></pre>
It can be useful as well to keep different sets of private variables for the <i>live</i>, <i>test</i> and <i>dev</i> sites.</div>
</div>
<div id="postamble" style="color: #888888; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px;">
<div class="author" style="padding: 0px;">
<br /></div>
<div class="date" style="padding: 0px;">
Date: 2013-07-09 18:26:01 CEST</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-52576563207761352232013-07-08T19:01:00.000+02:002013-07-08T19:01:48.323+02:00Development Setup Of B-Translator<a href="http://info.btranslator.org/" style="background-color: white; color: #990000; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; padding: 1px; text-decoration: none;">B-Translator</a><span style="background-color: white; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;"> helps to get feedback about </span><i style="background-color: white; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">l10n</i><span style="background-color: white; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;"> (translations of the programs). It tries to collect very small translation contributions from a wide crowd of people and to dilute them into something useful. It is developed as a Drupal7 profile and the </span><a href="https://github.com/dashohoxha/B-Translator" style="background-color: white; color: #113399; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; padding: 1px; text-decoration: none;">code</a><span style="background-color: white; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;"> is hosted on GitHub. Here I describe the development setup and process that I use for this project. Most of the the tips are project specific, however some of them can be used on any Drupal project.</span><br />
<a name='more'></a><br />
<div id="table-of-contents" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px; margin: 1em 0px; padding: 0.1em;">
<h2 style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Table Of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li>Installation</li>
<li>Changing the webserver</li>
<li>Re-installing the application</li>
<li>Making a clone for development</li>
<li>Making a backup of the application</li>
<li>Accessing the code of the application from outside chroot</li>
<li>Pushing commits to github</li>
<li>The commit workflow</li>
<li>Making a local git clone of the dev application</li>
<li>Working with a dev-test-live workflow</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-1" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Installation</h2>
<div class="outline-text-2" id="text-1">
Installation for development is the same as the installation for a production server, inside a chroot. The steps are like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">mkdir /var/chroot
cd /var/chroot/
git clone https://github.com/dashohoxha/B-Translator.git
nohup nice B-Translator/install/install.sh btr &
tail -f nohup.out
chroot btr/ /tmp/install/config.sh
chroot btr/ rm -rf /tmp/install
reboot ## it is advisable to reboot the host after this installation
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-2" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Changing The Webserver</h2>
<div class="outline-text-2" id="text-2">
The webserver that is used for production is NGINX because it is more responsive in high load, has build in cache, etc. The configuration of NGINX is also tweaked for production (has DoS protection, short timeout, etc.) For development Apache2 can be more suitable. It can be started and stopped like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
/var/www/btranslator/profiles/btranslator/dev/apache2.sh start
/var/www/btranslator/profiles/btranslator/dev/apache2.sh stop
</pre>
<b><br /></b>
<b>Important:</b> When <i>apache2</i> is started, the services <i>nginx</i>, <i>memcached</i> and <i>php5-fpm</i> are stopped. Don't forget to modify the init script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/init.d/chroot-btr</code> like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">#CHROOT_SERVICES="cron php5-fpm memcached mysql nginx"
CHROOT_SERVICES="cron mysql apache2"
</pre>
The script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">apache2.sh</code> cannot make this modification automatically because it runs inside the chroot, and the init script is outside the chroot (on the host system). So it has to be done manually.<br />
<br />
I also add something like this on <b>/etc/hosts</b>, so that I can access it on the browser with a domain name:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">127.0.1.1 l10n.org.xx dev.l10n.org.xx
</pre>
This modification has to be done manually as well.</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-3" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Re-Installing The Application</h2>
<div class="outline-text-2" id="text-3">
It can be done with the script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/install.sh</code>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
/var/www/btranslator/profiles/btranslator/dev/reinstall.sh
</pre>
It will rebuild the Drupal directory with <b>drush make</b> and install the btranslator profile with <b>drush site-install</b>, and then do all the rest of configurations just like they are done during installation.<br />
<br />
Normally there is no need to reinstall the application, unless we want to test the installation profile and the installation scripts.<br />
<br />
Another kind of re-installation, which touches only the database of Drupal (btranslator) and nothing else, can be done with the script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/install.sh</code>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
/var/www/btranslator/profiles/btranslator/dev/reinstall-db.sh
</pre>
It is useful for testing the features. Usually, when features are un-installed, things are not undone properly. In order to leave out a feature, it should not be installed since the beginning. So, it is important to test different combinations of them to see which one works better for us.</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-4" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Making A Clone For Development</h2>
<div class="outline-text-2" id="text-4">
Inside the chroot I make a clone for development like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
cd /var/www/btranslator/profiles/btranslator/
dev/clone.sh dev
</pre>
It creates a new application with root <b>/var/www/btranslator_dev/</b> and with DB named <b>btranslator_dev</b>. It also creates the drush alias <b>@dev</b>, and modifies the configuration of the webserver so that the cloned application can be accessed at<b>dev.l10n.org.xx</b>.<br />
<br />
<b>Caution:</b> The root directory and the DB of the clone will be erased, if they exist.<br />
Other clones like this can be created for testing etc. To cleanup (remove/erase) a clone, we can use <b>clone_rm.sh</b> like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
cd /var/www/btranslator/profiles/btranslator/
dev/clone_rm.sh dev
</pre>
<br />
By the way, we can also modify a little bit the configuration of a development copy of the application (in order to help us not confuse a development copy with a live or testing one), with the script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/config.php</code>:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
cd /var/www/
drush php-script btranslator/profiles/btranslator/config.php dev1
drush @dev php-script btranslator/profiles/btranslator/config.php dev2
</pre>
It will set site_name to 'B-Translator (dev1)', will make site email something like 'user+dev1@gmail.com', will enable email re-routing, display the <i>devel</i> menu on the footer region, etc. It is not required, but sometimes may be useful.</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-5" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Making A Backup Of The Application</h2>
<div class="outline-text-2" id="text-5">
Sometimes, when testing things on Drupal (installing/uninstalling modules etc.) things get messy and it is not possible anymore to revert to the state that you were before starting the test. In this case the only way to get safely to a previous stable state is by restoring a backup (or installing from the scratch and repeating all the configurations).<br />
<br />
A snapshot of the application is just like a full backup with a time stamp. It saves the state of the application at a certain time, both the code (the whole Drupal directory) and the database. It can be done like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">chroot /var/chroot/btr/
cd /var/www/
ln -s btranslator_dev/profiles/btranslator/ B-Translator
B-Translator/dev/snapshot.sh make
B-Translator/dev/snapshot.sh make @dev
</pre>
These will create the files <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">snapshot-btranslator-20130602.tgz</code> and <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">snapshot-btranslator_dev-20130602.tgz</code>. They can be restored like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">B-Translator/dev/snapshot.sh restore --file=snapshot-btranslator-20130602.tgz
B-Translator/dev/snapshot.sh restore --file=snapshot-btranslator_dev-20130602.tgz
B-Translator/dev/snapshot.sh restore @dev --file=snapshot-btranslator-20130602.tgz
B-Translator/dev/snapshot.sh restore @dev --file=snapshot-btranslator_dev-20130602.tgz
</pre>
<br />
As you may notice, a snapshot of @dev can also be restored on the main application, and the other way around.<br />
<br />
However, in many cases a backup/restore of the database is all that is needed, and it is more efficient. It can be done with<b>drush sql-dump</b> and <b>drush sql-query</b> like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush sql-dump > btranslator.sql
drush sql-dump @dev > btranslator_dev.sql
drush sql-query --file=$(pwd)/btranslator.sql
drush sql-query --file=$(pwd)/btranslator_dev.sql
drush @dev sql-query --file=$(pwd)/btranslator.sql
drush @dev sql-query --file=$(pwd)/btranslator_dev.sql
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-6" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-6" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Accessing The Code Of The Application From Outside Chroot</h2>
<div class="outline-text-2" id="text-6">
In order to access easily the code of the application from outside chroot, I create a symbolic link like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/chroot/
ln -s btr/var/www/btranslator_dev/profiles/btranslator/ \
dev
</pre>
Now I can go to <b>/var/chroot/dev/</b> and start <i>emacs</i> or any other tools. This way I don't have to install <i>emacs</i> or any other development tools inside the <i>chroot</i> and can use the best of development tools that my host environment can offer me.</div>
</div>
<div class="outline-2" id="outline-container-7" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-7" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-7" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Pushing Commits To Github</h2>
<div class="outline-text-2" id="text-7">
The copy of the application on <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator_dev/profiles/btranslator/</code> (as well as the one on<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator/profiles/btranslator/</code>) are actually clones of the git repository at <a href="https://github.com/dashohoxha/B-Translator" style="color: #113399; padding: 1px; text-decoration: none;">https://github.com/dashohoxha/B-Translator</a> so we can <b>pull</b> from it and <b>push</b> to it. Pulling (to get up-to-date) can be done by everybody, however pushing requires a username and password (the ones that are used to access the account at GitHub).</div>
</div>
<div class="outline-2" id="outline-container-8" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-8" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-8" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
The Commit Workflow</h2>
<div class="outline-text-2" id="text-8">
For small or straight-forward changes I can also work directly on the <b>master</b> branch, then <b>commit</b>, and then <b>push</b> to github.<br />
<br />
However I usually use a bit more complicated workflow. First I create and checkout a <b>dev</b> branch. When the work is done I merge this branch to <b>master</b> and then delete it. Finally <b>push</b> the commit(s) to github.<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">git checkout -d dev ### create a branch and switch to it
[work-commit-work-comit]
git checkout master ### switch back to master
git pull ### get any latest commits from github
git merge dev [--squash]
git push ### send commits to github
git branch -D dev ### erase the branch
</pre>
<br />
Usually there are no commits comming from github, since I am the only developper (unless I have worked and commited from some other location). So, when I merge without <b>–squash</b> this usually results in <b>fast-forward</b> merge, which means that all the commits that I have done on the branch <b>dev</b> are automatically transferred to the branch <b>master</b>.<br />
<br />
However sometimes there may be <i>dirty commits</i> on the <b>dev</b> branch, which means that there may be incomplete commits, or commits that reverse what was done on the previous commits etc. When I wish to reorganise commits and make them cleaner, I use the <b>–squash</b> option, which collects all the changes on the <b>dev</b> branch and leaves them on the <b>master</b>sandbox as local modifications (uncommitted). Then I can redo the commits on a cleaner or more logical way. Afterwards the <b>dev</b> branch will be deleted and the old commits will be lost.</div>
</div>
<div class="outline-2" id="outline-container-9" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-9" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-9" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Making A Local Git Clone Of The Dev Application</h2>
<div class="outline-text-2" id="text-9">
Sometimes it is not easy or suitable to test modifications on the <b>@dev</b> application (<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator_dev</code>). For example this is the case when I have to test install/uninstall, enable/disable modules, features, etc. In this case I test them on the main application instance (<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/var/www/btranslator</code>). Since both applications are clones of the <a href="https://github.com/dashohoxha/B-Translator" style="color: #113399; padding: 1px; text-decoration: none;">GitHub repository</a>, it is easy to push commits from <i>btranslator_dev</i> to <i>github</i> and to pull them from <i>github</i> to <i>btranslator</i>.<br />
<br />
However, sometimes it is better to test modifications and make sure that they work, before pushing them to <i>github</i>. This can be done if the code on <i>btranslator</i> is a git clone of the code on <i>btranslator_dev</i> (instead of being a clone from <i>github</i>).<br />
The script <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/git-clone-dev.sh</code> makes just this. It replaces the code of <i>btranslator</i> with a git clone of the <b>dev branch</b>from <i>btranslator_dev</i>. Then the workflow is like this:<br />
<ol>
<li>Work and commit on the branch <b>dev</b> of <b>btranslator_dev</b></li>
<li>Pull on <b>btranslator</b> and test.</li>
<li>Repeat steps <b>1</b> and <b>2</b> until the modification that we are making is OK.</li>
<li>Push changes upwards to github, like this:<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator_dev/profiles/btranslator
git checkout master
git merge dev [--squash]
git push
git branch -D dev
git checkout -b dev
</pre>
So, after merging to <b>master</b> and pushing to <i>github</i>, we delete the branch <b>dev</b> and create a new one.</li>
<li>Make a git pull on <b>btranslator</b> and sync it with <b>btranslator_dev</b><pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">cd /var/www/btranslator/profiles/btranslator
git pull
</pre>
</li>
</ol>
</div>
</div>
<div class="outline-2" id="outline-container-10" style="font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 16px;">
<h2 id="sec-10" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
<br /></h2>
<h2 id="sec-10" style="color: #992222; font-size: 1.4em; padding: 0.2em; text-transform: capitalize;">
Working With A Dev-Test-Live Workflow</h2>
<div class="outline-text-2" id="text-10">
All the work that is described on the sections above is about development and local testing that is done on a working copy (sandbox) of a <i>chroot</i> installation. This is usually installed on my personal machine (that I use for development).<br />
<br />
At some point, all the modifications have to be transferred to a public server, where the application is in "production", performing "live". On that public server there is the same <i>chroot</i> environment as in the development server. The synchronisation of the application can be done via git push and pull.<br />
<br />
However <b>drush rsync</b> and <b>drush sql-sync</b> offer another option for synchronisation. For more details see:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush help rsync
drush help sql-sync
drush topic docs-aliases
</pre>
These commands use drush <b>aliases</b>, which allow also remote execution of drush commands. On my development environment I have created the file <code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">/etc/drush/remote.aliases.drushrc.php</code>, which has a content like this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;"> '/var/www/btranslator',
'uri' => 'http://l10n.org.al',
'remote-host' => 'l10n.org.al',
'remote-user' => 'root',
'ssh-options' => '-p 2201 -i /root/.ssh/id_rsa',
'path-aliases' => array (
'%profile' => 'profiles/btranslator',
'%data' => '/var/www/btranslator_data',
'%pofiles' => '/var/www/PO_files',
'%exports' => '/var/www/exports',
'%downloads' => '/var/www/downloads',
),
'command-specific' => array (
'sql-sync' => array (
'simulate' => '1',
),
'rsync' => array (
'simulate' => '1',
),
),
);
$aliases['test'] = array (
'parent' => '@live',
'root' => '/var/www/btranslator',
'uri' => 'http://www2.l10n.org.al',
'remote-host' => 'www2.l10n.org.al',
'command-specific' => array (
'sql-sync' => array (
'simulate' => '0',
),
'rsync' => array (
'simulate' => '0',
),
),
);
</pre>
It defines the aliases <b>live</b> and <b>test</b>. The test/stage application is almost identical to the live/production one, however it is not for public use. The idea is to test there first any updates/upgrades of the application, in order to make sure that they don't break any things, before applying them to the real live application. In my case it is placed on a different server, however it can also be placed on the same server as the live application (just make a clone of the main application with<code style="color: #008800; font-family: 'Ubuntu Mono', monospace, courier;">dev/clone.sh test</code>).<br />
<br />
When everything is set up correctly, the synchronisation can be done as simply as this:<br />
<pre class="example" style="background-color: black; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: 'Ubuntu Mono', monospace, courier; font-size: 1.1em; overflow: auto; padding: 10px;">drush rsync @live @test
drush sql-sync @live @test
drush rsync @live @dev
drush sql-sync @live @dev
</pre>
<b>Note:</b> Synchronising this way from <b>@test</b> to <b>@live</b> or from <b>@dev</b> to <b>@live</b>, usually is a HUGE mistake, but the <i>simulate</i>option on the config file will make sure that it fails.<br />
<br />
For drush commands to work remotely, <b>ssh</b> daemon has to be running on the remote server, inside the chroot environment. By default it is not installed, but it can be installed with the script <b>dev/install-sshd.sh</b>. This script will also take care to change the ssh port to <b>2201</b>, in order to avoid any conflicts with any existing daemon on the host environment, and also for increased security.<br />
<br />
For remote access to work correctly, the public/private key ssh access should be set up and configured as well. For more detailed instructions on how to do it see: <a href="http://dashohoxha.blogspot.com/2012/08/how-to-secure-ubuntu-server.html" style="color: #113399; padding: 1px; text-decoration: none;">http://dashohoxha.blogspot.com/2012/08/how-to-secure-ubuntu-server.html</a></div>
</div>
<div id="postamble" style="color: #888888; font-family: Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; margin: 0px; padding: 0px;">
<div class="author" style="padding: 0px;">
<br /></div>
<div class="date" style="padding: 0px;">
Date: 2013-07-08 17:54:13 CEST</div>
<div class="creator" style="padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-39261095576252501362013-07-01T13:13:00.000+02:002013-07-01T13:13:39.022+02:00How To Manage Your Own Domain Name Server<div style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
In the old times (when men were real men), people used to manage their domains with their own domain name server. There is now a long time since things got easy and sweet. Nowadays you usually rely on the services provided by your ISP for managing your domain, which often means that you do everything from a nice web interfaces.</div>
<div style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<br /></div>
<div style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
However there are people (like me) that prefer to do things the old and sweaty way, which means that you install and manage your own name server. I will describe here how I did it for myself. Actually it is not so difficult, if you know some concepts about how DNS works and you have some basic command-line skills.</div>
<a name='more'></a><br />
<div class="outline-2" id="outline-container-1" style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<h2 id="sec-1" style="font-size: 24px; padding: 0.2em; text-transform: capitalize;">
<span class="section-number-2">1</span> The Concepts</h2>
<div class="outline-text-2" id="text-1">
I have installed my NS on a cloud server (provided by Rackspace). It is a <b>hidden master, authoritative only</b> DNS server.<br />
<br />
<b>Hidden</b> means that it stays behind a firewall, not accessible from the outside world. <b>Master</b> or <b>primary</b> means that it is a primary source of information for the domains that it provides. There are also <b>slave/secondary</b> DNS servers, which get the information of the domains that they cover from other (master/primary) servers. If we update the domain on a master server, the slaves will synchronise with it automatically after a certain time.<br />
<br />
<b>Authoritative only</b> means that the server will just give answers for the domains that it masters, and nothing else. DNS servers can possibly do several things, for example give answers to DNS requests from clients, both for the domains that they are responsible for and for other domains. If they don't know the answer, they get it from the Internet, fetch it to the client and then cache it for future requests. However this server does not do any of these things. It just answers for its own domains.<br />
<br />
But there is a catch here: if the server stays behind the firewall, hidden from the world and does not accept any requests from clients, where should the clients send queries about our domain? The answer is that they will query some <b>slave/secondary</b> DNS servers which are synchronised with our server. Fortunately there are lots of free secondary DNS services out there. I use puck.nether.net and buddyns.com .<br />
<br />
To get a better idea of the concepts discussed here, look at:<br />
<ul>
<li><a href="http://www.inetdaemon.com/tutorials/internet/dns/configuration/hidden_master.shtml" style="color: #113399; padding: 1px; text-decoration: none;">http://www.inetdaemon.com/tutorials/internet/dns/configuration/hidden_master.shtml</a></li>
<li><a href="http://www.zytrax.com/books/dns/ch4/" style="color: #113399; padding: 1px; text-decoration: none;">http://www.zytrax.com/books/dns/ch4/</a></li>
<li><a href="http://www.zytrax.com/books/dns/ch6/" style="color: #113399; padding: 1px; text-decoration: none;">http://www.zytrax.com/books/dns/ch6/</a></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<h2 id="sec-2" style="font-size: 24px; padding: 0.2em; text-transform: capitalize;">
<span class="section-number-2">2</span> Installation</h2>
<div class="outline-text-2" id="text-2">
Install <b>bind9</b>:<br />
<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">apt-get install bind9
</pre>
After installation, edit <code style="color: blue;">/etc/default/bind9</code> and add a <b>-4</b> to the options:<br />
<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;"># run resolvconf?
RESOLVCONF=no
# startup options for the server
OPTIONS="-u bind -4"
</pre>
This will tell bind9 to run only on IPv4 interfaces (ignoring IPv6). Not necessary, but will prevent some error messages on syslog that might be confusing.</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<h2 id="sec-3" style="font-size: 24px; padding: 0.2em; text-transform: capitalize;">
<span class="section-number-2">3</span> Setup Secondary Servers</h2>
<div class="outline-text-2" id="text-3">
Register your domain(s) on two or more secondary servers:<br />
<ul>
<li><a href="https://www.buddyns.com/" style="color: #113399; padding: 1px; text-decoration: none;">https://www.buddyns.com</a></li>
<li><a href="https://puck.nether.net/" style="color: #113399; padding: 1px; text-decoration: none;">https://puck.nether.net/</a></li>
<li><a href="http://networking.ringofsaturn.com/Unix/freednsservers.php" style="color: #113399; padding: 1px; text-decoration: none;">http://networking.ringofsaturn.com/Unix/freednsservers.php</a></li>
</ul>
On your server, allow the secondary servers to access your DNS server:<br />
<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">ufw allow from 173.244.206.26 to any port 53
ufw allow from 88.198.106.11 to any port 53
ufw allow from 204.42.254.5 to any port 53
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<h2 id="sec-4" style="font-size: 24px; padding: 0.2em; text-transform: capitalize;">
<span class="section-number-2">4</span> Configuration Of The DNS Server</h2>
<div class="outline-text-2" id="text-4">
Configuration files of <b>bind9</b> are located at <code style="color: blue;">/etc/bind/</code>.<br />
<ul>
<li>Edit the file <code style="color: blue;">/etc/bind/named.conf</code> and comment the line of <i>default-zones</i>:<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
#include "/etc/bind/named.conf.default-zones";
</pre>
</li>
<li>Edit <code style="color: blue;">/etc/bind/named.conf.options</code>:<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">options {
directory "/var/cache/bind";
recursion no;
allow-transfer {
173.244.206.26; # a.transfer.buddyns.com
88.198.106.11; # b.transfer.buddyns.com
204.42.254.5; # puck.nether.net
};
};
</pre>
Only the IPs of the secondary servers are allowed to get and synchronise the information of our domains. The directive "<b>recursion no;</b>" tells the server to not reply for any other domains except for its own. Actually it is behind a firewall and should not get any DNS queries, but just in case.</li>
<li>Edit <code style="color: blue;">/etc/bind/named.conf.local</code> and add the configuration of the zones:<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">zone "l10n.org.al" {
type master;
also-notify {
173.244.206.26; # a.transfer.buddyns.com
88.198.106.11; # b.transfer.buddyns.com
204.42.254.5; # puck.nether.net
};
file "/var/cache/bind/db.l10n.org.al";
};
zone "btranslator.org" {
type master;
also-notify {
173.244.206.26; # a.transfer.buddyns.com
88.198.106.11; # b.transfer.buddyns.com
204.42.254.5; # puck.nether.net
};
file "/var/cache/bind/db.btranslator.org";
};
</pre>
Our server is master for both of these domains, and when they are modified it will notify the secondary servers about it (so that they can transfer and sync the data).</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: 'Bitstream Vera Sans', Verdana, sans-serif; font-size: 14px;">
<h2 id="sec-5" style="font-size: 24px; padding: 0.2em; text-transform: capitalize;">
<span class="section-number-2">5</span> Configuration Of The Domains</h2>
<div class="outline-text-2" id="text-5">
The files that keep the configuration of the domain zones are placed on <code style="color: blue;">/var/cache/bind/</code>.<br />
<ul>
<li>Create the file <code style="color: blue;">/var/cache/bind/db.l10n.org.al</code> with a content like this:<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">; l10n.org.al
$TTL 24h
$ORIGIN l10n.org.al.
@ 1D IN SOA ns1.l10n.org.al. admin.l10n.org.al. (
2013070101 ; serial
3H ; refresh
15m ; retry
1w ; expire
2h ; minimum
)
IN NS b.ns.buddyns.com.
IN NS c.ns.buddyns.com.
IN NS puck.nether.net.
IN MX 1 aspmx.l.google.com.
IN MX 5 alt1.aspmx.l.google.com.
IN MX 5 alt2.aspmx.l.google.com.
IN MX 10 aspmx2.googlemail.com.
IN MX 10 aspmx3.googlemail.com.
IN TXT "v=spf1 include:_spf.google.com ~all"
google._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSxGSIb3DQEBAQUBA4GNADCBiQ5BgQCWKzwJ1kui8IVQmTbphXvkETTJWbqOyDqbkppfBrcos1+gIixvM-MYSVUrawpzyaaxEPg3IT/Wq8MF3S58/cUtwv3Idv6IkQxIU6ub8/uEq900ILD9EuQX32jUk+pfpJtDoeA0vm1vhv1taIGr4W5ds2HXyQXX1qKcyShRAC2O/wIDAQAB"
; server host definitions
ns1.l10n.org.al. IN A 198.101.226.171
@ IN A 198.101.226.171
www IN A 198.101.226.171
mail IN CNAME ghs.google.com.
</pre>
Don't forget to change the serial number whenever this file is modified, otherwise the changes may not be noticed and propagated on the Internet. The other 'magic' numbers can be left as they are.<br />
You also see that only the secondary servers are listed as nameservers for our domain. So, when clients have any questions about our domain, they go and ask them, not our server (which is behind a firewall and cannot be reached).<br />
<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">IN NS b.ns.buddyns.com.
IN NS c.ns.buddyns.com.
IN NS puck.nether.net.
</pre>
Also, it happens that I use GoogleApps for the email and other services (it offers up to 10 email accounts for free), and this is reflected on the configuration of the domain.</li>
<li>Very similar is the configuration of the other domain. Create the file <code style="color: blue;">/var/cache/bind/db.btranslator.org</code> with a content like this:<pre class="example" style="background-color: black; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1pt solid rgb(174, 189, 204); color: #eeeeee; font-family: courier, monospace; font-weight: bold; overflow: auto; padding: 5pt;">; btranslator.org
$TTL 24h
$ORIGIN btranslator.org.
@ 1D IN SOA ns1.btranslator.org. admin.btranslator.org. (
2013070101 ; serial
3H ; refresh
15m ; retry
1w ; expire
2h ; minimum
)
IN NS b.ns.buddyns.com.
IN NS c.ns.buddyns.com.
IN NS puck.nether.net.
IN MX 1 aspmx.l.google.com.
IN MX 5 alt1.aspmx.l.google.com.
IN MX 5 alt2.aspmx.l.google.com.
IN MX 10 aspmx2.googlemail.com.
IN MX 10 aspmx3.googlemail.com.
IN TXT "v=spf1 include:_spf.google.com ~all"
google._domainkey IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSxGSIb3DQEBAQUBA4GNADCBiQ5BgQCWKzwJ1kui8IVQmTbphXvkETTJWbqOyDqbkppfBrcos1+gIixvM-MYSVUrawpzyaaxEPg3IT/Wq8MF3S58/cUtwv3Idv6IkQxIU6ub8/uEq900ILD9EuQX32jUk+pfpJtDoeA0vm1vhv1taIGr4W5ds2HXyQXX1qKcyShRAC2O/wIDAQAB"
; server host definitions
ns1.l10n.org.al. IN A 198.101.226.171
@ IN A 198.101.226.171
; point to the server any subdomain
* IN A 198.101.226.171
mail IN CNAME ghs.google.com.
</pre>
</li>
</ul>
Some other help pages about the configuration of bind9 on Ubuntu:<br />
<ul>
<li><a href="https://help.ubuntu.com/lts/serverguide/dns-configuration.html" style="color: #113399; padding: 1px; text-decoration: none;">https://help.ubuntu.com/lts/serverguide/dns-configuration.html</a></li>
<li><a href="http://wernerstrydom.com/2013/02/23/configuring-ubuntu-server-12-04-as-dns-server/" style="color: #113399; padding: 1px; text-decoration: none;">http://wernerstrydom.com/2013/02/23/configuring-ubuntu-server-12-04-as-dns-server/</a></li>
</ul>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-32651104169713108042013-06-21T19:06:00.000+02:002013-06-21T19:06:01.580+02:00Dual Boot Puppy Linux With Ubuntu<br />
<div style="font-family: Times, serif; font-size: 16px;">
Puppy Linux is so nice that I always keep it around even if I don't need it. I have a small partition on my laptop where I install different versions of Puppy, and they co-exist with my main Ubuntu (actually Xubuntu) system. The installation is very easy.</div>
<a name='more'></a><br />
<div style="font-family: Times, serif; font-size: 16px;">
Lately I have installed <a href="http://bkhome.org/blog2/?viewDetailed=00275">Precise Puppy 5.6.1</a> and <a href="http://bkhome.org/blog2/?viewDetailed=00164">Slacko Puppy 5.5</a> . After downloading the <b>.iso</b> files, I extracted them and copied their content on <b>/dev/sda9 </b>like this:</div>
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">sudo su
mkdir sda9
mount /dev/sda9 sda9/
mkdir iso
mount -o loop precise-5.6.1.iso iso/
mkdir -p sda9/puppy/precise5.6.1
cp -a iso/* sda9/puppy/precise5.6.1/
umount iso/
mount -o loop slacko-5.5-PAE.iso iso/
mkdir -p sda9/puppy/slacko5.5
cp -a iso/* sda9/puppy/slacko5.5/
umount iso/
rmdir iso/
umount sda9/
rmdir sda9
</pre>
<div style="font-family: Times, serif; font-size: 16px;">
<br /></div>
<div style="font-family: Times, serif; font-size: 16px;">
The installation is already finished! But we need a way to boot the puppies. We can do this by modifying the grub menu. First add these lines on the config file <code>/etc/grub.d/40_custom</code>:</div>
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">menuentry "Puppy Linux Slacko 5.5 frugal (sda9/puppy/slacko5.5)" --class gnu-linux --class gnu --class os {
set root='(hd0,msdos9)'
#find --set-root --ignore-floppies /puppy/slacko5.5/initrd.gz
linux /puppy/slacko5.5/vmlinuz pmedia=atahd psubdir=puppy/slacko5.5
initrd /puppy/slacko5.5/initrd.gz
}
menuentry "Puppy Linux Precise 5.6.1 frugal (sda9/puppy/precise5.6.1)" --class gnu-linux --class gnu --class os {
set root='(hd0,msdos9)'
#find --set-root --ignore-floppies /puppy/precise5.6.1/initrd.gz
linux /puppy/precise5.6.1/vmlinuz pmedia=atahd psubdir=puppy/precise5.6.1
initrd /puppy/precise5.6.1/initrd.gz
}
</pre>
<div style="font-family: Times, serif; font-size: 16px;">
Then run the command <b>sudo update-grub</b>.</div>
<div style="font-family: Times, serif; font-size: 16px;">
<br /></div>
<div style="font-family: Times, serif; font-size: 16px;">
Now reboot the PC and have fun with Puppy.</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-72355251428935709642013-06-12T21:21:00.001+02:002013-06-13T07:14:10.983+02:00How to Setup a WiFi Access Point on UbuntuIf you have a single wired Internet connection (like in a hotel room) you can create Wireless Access Point with Ubuntu and share the Internet connection among multiple devices. This can be done very easily on Ubuntu (whatch this tutorial: <a href="http://www.youtube.com/watch?v=G0FFQVy3RUg">http://www.youtube.com/watch?v=G0FFQVy3RUg</a>) It will create an ad-hoc wifi network. However ad-hoc networks are not supported in some android models, windows mobile, and iOS devices. A more universal solution is to create an Access Point (or Infrastructure, or Hotspot) wifi network. This is a bit more complicated but not so difficult. Here I will describe how to do it.<br />
<a name='more'></a><div class="outline-2" id="outline-container-1">
<h2 id="sec-1">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-1">
<span class="section-number-2">1</span> Check whether the wireless card supports Access Point mode</h2>
<div class="outline-text-2" id="text-1">
First thing to be done is to test whether your wireless card supports going into wireless access point mode. This test is for mac80211 framework based driver.<br />
<br />
Install iw and run the command iw list:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">sudo aptitude install iw
iw list
</pre>
Look for supported interface section, where it should be a entry called <b>AP</b> like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">Supported interface modes:
* IBSS
* managed
* AP
* AP/VLAN
* monitor
* mesh point
</pre>
If your driver doesn't show this <b>AP</b>, it doesn't mean it can't create wireless hotspot. But those cards aren't in the scope of this tutorial.</div>
</div>
<div class="outline-2" id="outline-container-2">
<h2 id="sec-2">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-2">
<span class="section-number-2">2</span> Setup and host a network</h2>
<div class="outline-text-2" id="text-2">
Install <b>hostapd</b> (<code>sudo aptitude install hostapd</code>) and create the configuration file <code>/etc/hostapd/hostapd.conf</code> with a content like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">interface=wlan0
driver=nl80211
ssid=name_of_network
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
</pre>
Things that you need to change here are:<br />
<ul>
<li>Change <code>interface=wlan0</code> to your wireless card name. If you have one wireless card it should be <i>wlan0</i>.</li>
<li>Change <code>ssid=name_of_network</code> with the name that you want to give to yout hosted network.</li>
<li>Change <code>wpa_passphrase=1234567890</code> with the password for accessing your network.</li>
</ul>
The name of the wifi interface can be found with a command like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">lshw -quiet -c network | sed -n -e '/Wireless interface/,+12 p' | sed -n -e '/logical name:/p' | cut -d: -f2 | sed -e 's/ //g
</pre>
The configuration above creates a WPA & WPA2 enabled access point in <b>g</b> mode. A more detailed instruction on how to build the configuration file can be found here: <a href="http://wireless.kernel.org/en/users/Documentation/hostapd">http://wireless.kernel.org/en/users/Documentation/hostapd</a><br />
Before starting <b>hostapd</b>, we should also edit the file <code>/etc/default/hostapd</code> and modify the line of <b>DAEMON<sub>CONF</sub></b> like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">DAEMON_CONF="/etc/hostapd/hostapd.conf"
</pre>
Now we can start <b>hostapd</b> with the command <code>sudo service hostapd start</code>. It should start a wireless network. In your mobile device now you can see a wireless network and can authenticate. But the device won't get IP address. Stop it with the command <code>sudo service hostapd stop</code>.<br />
<b>Note:</b> If you get any errors, maybe your card doesn't support <b>g</b> mode. Try with other modes (see: <a href="http://linuxwireless.org/en/users/Documentation/hostapd">http://linuxwireless.org/en/users/Documentation/hostapd</a>).</div>
</div>
<div class="outline-2" id="outline-container-3">
<h2 id="sec-3">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-3">
<span class="section-number-2">3</span> Set up DHCP server for IP address management</h2>
<div class="outline-text-2" id="text-3">
Install <b>isc-dhcp-server</b> (<code>aptitude install isc-dhcp-server</code>).<br />
Edit the file <code>/etc/default/isc-dhcp-server</code> and set INTERFACES like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">INTERFACES="wlan0"
</pre>
Modify the name of the wireless interface accordingly, as in the section above.<br />
Then modify the configuration file <code>/etc/dhcp/dhcpd.conf</code> like this:<br />
<ol>
<li>Comment the following lines:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">#option domain-name “example.org”;
#option domain-name-servers ns1.example.org, ns2.example.org;
#default-lease-time 600;
#max-lease-time 7200;
</pre>
</li>
<li>Append these lines as the end:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.2 10.10.0.16;
option domain-name-servers 8.8.4.4, 208.67.222.222;
option routers 10.10.0.1;
}
</pre>
</li>
</ol>
Range describes how large the address pool will be. You need to adjust subnet value also. The config above can give IP up to 15 devices.<br />
Now edit <code>/etc/network/interfaces</code> and add the following lines:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">auto wlan0
iface wlan0 inet static
address 10.10.0.1
netmask 255.255.255.0
</pre>
<i>wlan0</i> is your wireless interface; change it accordingly.<br />
<b>Note:</b> After reboot, the wireless will be shown as not managed. So you can't use any other wi-fi network. To get wireless with normal behaviour, put # before those newly added lines and execute <code>sudo service networking restart</code><br />
If you start now the services <b>isc-dhcp-server</b> and <b>hostapd</b>, your mobile device will see a network, authenticate to it and after authentication it will get as IP address something like 10.10.0.2 But still it can't connect to internet.</div>
</div>
<div class="outline-2" id="outline-container-4">
<h2 id="sec-4">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-4">
<span class="section-number-2">4</span> Share the internet connection</h2>
<div class="outline-text-2" id="text-4">
For Internet connection sharing we need <i>IP forwarding</i> and <i>IP masquerading</i>.<br />
Enable IP forwarding like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">echo 1 > /proc/sys/net/ipv4/ip_forward
</pre>
Setup IP masquerading like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">iptables -t nat -A POSTROUTING -s 10.10.0.0/16 -o ppp0 -j MASQUERADE
</pre>
Here <b>ppp0</b> is the logical interface name if you are using a dial up/usb modem connection to Internet. It may be <b>eth0</b> if you are using an Ethernet cable connection. If you are connecting to Internet through an android device with USB tethering, then the interface name could be <b>usb0</b>.<br />
You can find out the name of the logical interface that you are using to connect to the Internet with a command like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">ip route | grep default | cut -d' ' -f5
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-5">
<h2 id="sec-5">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-5">
<span class="section-number-2">5</span> Script to Automate the Installation</h2>
<div class="outline-text-2" id="text-5">
I like to automate configuration steps whenever it is possible and it is something that can be reused. Here is a script on <i>gist</i> that can be used to install a wifi access point automatically: <a href="https://gist.github.com/dashohoxha/5767262">https://gist.github.com/dashohoxha/5767262</a><br />
It should work well on Ubuntu 12.04 or its derivatives (for example Linux Mint). Let me know if there are any bugs on it or things that can be fixed or improved.</div>
</div>
<div class="outline-2" id="outline-container-6">
<h2 id="sec-6">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-6">
<span class="section-number-2">6</span> Referencies</h2>
<div class="outline-text-2" id="text-6">
<ul>
<li><a href="http://askubuntu.com/questions/180733/how-to-setup-a-wi-fi-hotspot-access-point-mode/180734#180734">http://askubuntu.com/questions/180733/how-to-setup-a-wi-fi-hotspot-access-point-mode/180734#180734</a></li>
<li><a href="https://help.ubuntu.com/community/SharingMobileBroadband">https://help.ubuntu.com/community/SharingMobileBroadband</a></li>
<li><a href="http://askubuntu.com/questions/140126/how-do-i-configure-a-dhcp-server">http://askubuntu.com/questions/140126/how-do-i-configure-a-dhcp-server</a></li>
<li><a href="http://linuxwireless.org/en/users/Documentation/hostapd">http://linuxwireless.org/en/users/Documentation/hostapd</a></li>
</ul>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com1tag:blogger.com,1999:blog-5945244389322428562.post-10456297582562176572013-05-04T15:36:00.000+02:002013-05-04T15:36:00.809+02:00Solving an interesting algorithmic problemThe second problem on <em>Google CodeJam 2013, Round 1B</em> was interesting: <a href="https://code.google.com/codejam/contest/2418487/dashboard#s=p1&a=1">Problem B. Manage your Energy</a> . The obvious solution of trying all the possible cases and combinations would not work, unless the input had very small limits (besides being not so easy to implement).<br />
<a name='more'></a><br />
The solution, as described on the <a href="https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1">Contest Analysis</a> was a <em>greedy algorithm</em>: try to spend as much energy as possible for the activity with the highest value, neglecting the other activities if needed; then try to spend as much energy as possible for the activity with the second highest values, neglecting the others if needed, and so on.<br />
<br />
Actually, I suspected during the contest that a greedy algorithm may be the solution, however I couldn't find a way of implementing it properly. Even days after the contest I was not able to think of a suitable implementation. Only after seeing the solution on the <a href="https://code.google.com/codejam/contest/2418487/dashboard#s=a&a=1">Contest Analysis</a> I could see how it could possibly be implemented (keeping a pair of constraints for each value on the list, and updating them while processing the list).<br />
<br />
But then I saw a post on the <a href="https://plus.google.com/u/0/communities/108868943712030139628">CodeJam Community</a>, that somebody had implemented a recursive solution, and then suddenly things became much clear and cleaner. Usually the recursive solutions are more elegant and more easy to understand and implement, and this is true for this case as well.<br />
<br />
Below is the recursive implementation that I did to solve this problem:<br />
<br />
<script src="https://gist.github.com/dashohoxha/5517373.js"></script>
<br />
But there was something more interesting to this problem. Usually, the good (fast) solution, as described on the CodeJam Analysis, is of complexity <strong>O(N*N)</strong>. Using special implementation techniques it could also be improved to <strong>O(N*logN)</strong>. But during the contest there was somebody that had solved it with a linear algorithm, complexity <strong>O(N)</strong> ! This was surprising because even the contest organizers were not aware of such a solution before the contest!<br />
<br />
Below is my implementation of this solution of complexity <strong>O(N)</strong>:<br />
<br />
<script src="https://gist.github.com/dashohoxha/5517391.js"></script>Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-70179331972898052202013-03-15T08:31:00.001+01:002013-04-25T18:11:37.192+02:00Exporting Custom Configurations From a Drupal 7 Site<span style="font-family: Arial, Helvetica, sans-serif;">After installing a Drupal7 site, I have made several configurations/customizations over time. Now I would like to export them somehow, in order to load them to another site. But the problem is that I don't remember exactly what I have done. The </span><i style="font-family: Arial, Helvetica, sans-serif;">Features</i><span style="font-family: Arial, Helvetica, sans-serif;"> module does not help because you have to tell it exactly what to export, but I don't remember all the changes.</span><br />
<a name='more'></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This is a difficult problem on Drupal 7, which is expected to be solved on Drupal 8, by the <a href="http://groups.drupal.org/build-systems-change-management/cmi">Config Management Initiative</a>. However there is the <a href="http://drupal.org/project/configuration">Configuration Module</a> that tries to solve the configuration problem on Drupal 7, as a backport feature from Drupal 8.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">With the help of the <i>Configuration</i> module you basically track certain elements of configuration on your site (this bit is relatively similar to <i>Features</i>), and then it tells you when there are differences between what is stored in the filesystem and what is stored in the database (referred to as <i>ActiveStore</i> and <i>DataStore</i>). These config files can then be versioned and deployed. If the Diff module is installed, you can also see what has been changed with regards to ActiveStore vs DataStore.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This is useful for keeping track of specific configurations on a Drupal site, provides the ability to move these configurations between different environments (local, dev, qa, prod), and also allows to move configurations between completely different sites (migrate configurations).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This module helped me to solve my problem, although the solution was not 100% automatic and required some manual work. The basic steps are these:</span><br />
<div style="font-size: 16px;">
</div>
<ol>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Install a fresh Drupal 7 site. Install also the Configuration module.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Export all of its configurations (with the help of the Configuration module).</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Install the Configuration and Diff modules on the original (customized) Drupal 7 site.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Export all the configurations of the customized site (with the help of the Configuration module).</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Migrate the configuration of the fresh Drupal site to the customized site. Now the ActiveStore (DB) is different from the DataStore (files) and the Configuration module will show you what are the differences.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Untrack all the configurations that are not different. Some of the configurations that may contain sensitive data or useless data (for example cached data) should be untracked as well.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Export again the remaining configurations. Now these configurations can be imported on another Drupal 7 site, in order to make it very similar to the original customized site.</span></li>
</ol>
<span style="font-family: Arial, Helvetica, sans-serif;">Below is described in more details how to accomplish some of these steps.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<br />
<br />
<div class="outline-2" id="outline-container-1" style="font-size: 16px;">
<h2 id="sec-1">
<span style="font-family: Arial, Helvetica, sans-serif;">Installing the <a href="http://drupal.org/project/configuration">Configuration Module</a> and the <a href="http://drupal.org/project/diff">Diff Module</a></span></h2>
<div class="outline-text-2" id="text-1">
<span style="font-family: Arial, Helvetica, sans-serif;">These modules are installed on both Drupal sites. Doing it through the admin GUI takes a lot of time, and in my server very often the web server times out, so I have to do it with drush on command line, no matter whether I like it or not (actually I like it).</span><br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">cd sites/all/modules/
wget http://ftp.drupal.org/files/projects/configuration-7.x-2.x-dev.tar.gz
tar xfz configuration-7.x-2.x-dev.tar.gz
drush --yes pm-enable configuration configuration_ui
cd ../../
sudo mkdir sites/default/files/config
sudo chown www-data: sites/default/files/config
cd sites/all/modules/
wget http://ftp.drupal.org/files/projects/diff-7.x-3.2.tar.gz
tar xfz diff-7.x-3.2.tar.gz
drush --yes pm-enable diff
drush php-eval "menu_rebuild();"
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-size: 16px;">
<h2 id="sec-2">
<span style="font-family: Arial, Helvetica, sans-serif;">Exporting all the configurations of the site</span></h2>
<div class="outline-text-2" id="text-2">
<span style="font-family: Arial, Helvetica, sans-serif;">This is also done on both sites. Again I prefer to do it from the command line.</span><br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">drush cc drush
drush config-start-tracking --all
drush config-export --all
</pre>
<span style="font-family: Arial, Helvetica, sans-serif;">After this, the directory <code>sites/default/files/config/</code> will contain all the exported configurations of the corresponding site. The ActiveStore (DB) and the DataStore (<code>config/</code> directory) will have the same configuration.</span></div>
</div>
<div class="outline-2" id="outline-container-3" style="font-size: 16px;">
<h2 id="sec-3">
<span style="font-family: Arial, Helvetica, sans-serif;">Migrating the configurations of the fresh site to the customized site</span></h2>
<div class="outline-text-2" id="text-3">
<span style="font-family: Arial, Helvetica, sans-serif;">This can be done maybe using Export and Import from the GUI. However it is much more easy to just copy the directories from the command line. We can move the <code>config/</code> directory of the old site to <code>config_bak/</code> (or something like this), and in its place we copy the <code>config/</code> directory of the new site.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">After this, the ActiveStore (DB) and the DataStore (<code>config/</code> dir) will have different contents. Comparing them from the UI of the Configuration module is more easy and reliable that using any other tricks (for example from command line).</span></div>
</div>
<div class="outline-2" id="outline-container-4" style="font-size: 16px;">
<h2 id="sec-4">
<span style="font-family: Arial, Helvetica, sans-serif;">Finding changes in the configuration of the old site</span></h2>
<div class="outline-text-2" id="text-4">
<span style="font-family: Arial, Helvetica, sans-serif;">On the path <code>admin/config/system/configuration</code> we will find all the configurations that are being tracked. Since we have changed the DataStore from the command line, the status of each configuration will be 'Processing…' for some time. After all the processing is done, the status will show us what configurations are the same and what are different with the ActiveStore.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Now we simply select and stop tracking all the configurations that have not been changed. We should also stop tracking some of the configurations that are not relevant or that contain any sensitive data (this part is a bit manual and tedious, since we have to check all the configurations one by one). In the end, we can export the remaining configurations and import them on another site.</span></div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-63318278833773764352013-02-22T22:28:00.000+01:002013-04-25T18:15:05.043+02:00How to find all the modifications in the configuration of a server<div class="outline-2" style="background-color: white; color: #424037; font-size: 16px; line-height: 21.59375px; margin: 0px; padding: 0px;">
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">I manage a virtual web server in the cloud (<a href="https://l10n.org.al/" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: initial;">https://l10n.org.al</a>) where I have made lots of configurations over time: installing new packages, tweakings for optimization, changes related to security, etc. Now, if I want to build another server that has the same function and purpose as the first one, I don't remember all the things that I have touched and changed. The long and tedious way would be to go over all the installations and configurations again, and still I may miss something.</span></div>
<a name='more'></a><div style="font-family: Times, serif;">
<br /></div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">I thought that maybe there is any tool out there that can make something like a diff between the current state of the server and the initial state of a just installed server. This diff would also help me to audit the current system, because some of the things that I have tested maybe are not needed anymore. Such a diff could also serve as a recipe that I can share with my friends, if they want to build a system like mine. It would be much more convenient and safe than passing around huge tarballs or images.</span></div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">However I couldn't find anything suitable that can do it automatically, so I tried to do it manually. The basic idea is that the configuration files are placed on<code style="margin: 0px; padding: 0px;">/etc</code>. If two systems have the same packages installed, and you make a diff of their <code style="margin: 0px; padding: 0px;">/etc</code> directories, you will basically get all the configuration changes between them (maybe not 100% of them but still very accurate).</span></div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">So, what I did to find the configuration changes on my system was this:</span></div>
<ol style="margin: 15px 0px 15px 20px; padding: 0px;">
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Install a minimal system with <em style="margin: 0px; padding: 0px;">debootstrap</em>:</span><ol style="margin: 15px 0px 15px 20px; padding: 0px;">
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Install the packages <em style="margin: 0px; padding: 0px;">debootstrap</em> and <em style="margin: 0px; padding: 0px;">dchroot</em>:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">sudo apt-get install debootstrap dchroot</pre>
</div>
</div>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Add these line to <code style="margin: 0px; padding: 0px;">/etc/schroot/schroot.conf</code>:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">[precise]
description=Ubuntu Precise LTS
location=/var/chroot/precise
priority=3
users=ubuntu
groups=sbuild
root-groups=root</pre>
</div>
</div>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Bootstrap the chroot with a minimal Ubuntu installation:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">debootstrap --variant=minbase --arch=amd64 precise \
/var/chroot/precise http://mirror.rackspace.com/ubuntu/
cp /etc/resolv.conf /var/chroot/precise/etc/resolv.conf
cp /etc/apt/sources.list /var/chroot/precise/etc/apt/
mount -o bind /proc /var/chroot/precise/proc
chroot /var/chroot/precise/ apt-get install ubuntu-minimal</pre>
</div>
</div>
</li>
</ol>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Make sure to install on the chroot system all the packages that are installed on the main system:</span><ol style="margin: 15px 0px 15px 20px; padding: 0px;">
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Find a list of the packages installed in the main (host) system:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">dpkg --get-selections \
| grep '[[:space:]]install$' \
| awk '{print $1}' > installedpackages</pre>
</div>
</div>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Find a list of the packages installed in the chroot system:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">chroot /var/chroot/precise/ dpkg --get-selections \
| grep '[[:space:]]install$' \
| awk '{print $1}' > installedpackages_chroot</pre>
</div>
</div>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Make a diff between the two package lists:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">diff -ubB installedpackages installedpackages_chroot > packages.diff</pre>
</div>
</div>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Install on the chroot system all the packages that are installed on the main system:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">cp installedpackages /var/chroot/precise/
chroot /var/chroot/precise/
cat installedpackages | xargs apt-get install -y</pre>
</div>
</div>
</li>
</ol>
</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;"><span style="font-family: Arial, Helvetica, sans-serif;">Make a diff between the <code style="margin: 0px; padding: 0px;">/etc</code> dirs of both systems:</span><div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">diff -rubB /etc /var/chroot/precise/etc > etc.diff</pre>
</div>
</div>
</li>
</ol>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">Of course, this diff cannot be readily used to install and configure another system, but knowing where are the differences and what they are, can help to redo them manually.</span></div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">It can also help to build a tklpatch (like this: <a href="https://github.com/dashohoxha/B-Translator/tree/master/tklpatch" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: initial;">https://github.com/dashohoxha/B-Translator/tree/master/tklpatch</a>), which of course is not quite easy to be done and requires some work. Then, I can distribute/publish this tklpatch and everybody can build easily a system quite similar to mine.</span></div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">Referencies:</span></div>
<ul style="margin: 15px 0px 15px 15px; padding: 0px;">
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://dashohoxha.posterous.com/how-to-set-up-a-chroot-environment-for-testin" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: initial;"><span style="font-family: Arial, Helvetica, sans-serif;">http://dashohoxha.posterous.com/how-to-set-up-a-chroot-environment-for-testin</span></a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://www.debianadmin.com/clone-your-ubuntu-installation.html" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: initial;"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.debianadmin.com/clone-your-ubuntu-installation.html</span></a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://www.turnkeylinux.org/docs/tklpatch" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: initial;"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.turnkeylinux.org/docs/tklpatch</span></a></li>
</ul>
</div>
</div>
<div style="background-color: white; color: #424037; font-size: 16px; line-height: 21.59375px; margin: 0px; padding: 0px;">
<div class="date" style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">Date: 2013-02-22 22:19:54 CET</span></div>
<div class="creator" style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
<span style="font-family: Arial, Helvetica, sans-serif;">HTML generated by org-mode 6.33x in emacs 23</span></div>
</div>
<br />Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-52880371643698839582013-02-14T21:52:00.000+01:002013-02-14T21:52:18.347+01:00How to set up a chroot environment for testing<br />
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-1" style="font-family: Times, serif; font-size: 16px;">
<div class="outline-text-2" id="text-1">
Recently I have suffered a total system destruction in one of my computers. It happened while I was testing a software that I am developing, due to a <a _mce_href="https://github.com/dashohoxha/B-Translator/commit/522d3e919d8104e9419b0ac060067c484291cb6e" href="https://github.com/dashohoxha/B-Translator/commit/522d3e919d8104e9419b0ac060067c484291cb6e" target="_blank">simple bug</a>. It helped me realize my lack of caution while testing unstable things, and I learned that it is always better to do the testing inside a chroot environment. Chroot’s provide isolation from the rest of the operating system, so that in case of severe errors damage can be mitigated.<br />
<a name='more'></a><br /><br />
<br />
Here are the steps that I took for installing a chroot environment for testing.<br />
<ul>
<li>Install the packages <code>debootstrap</code> and <code>dchroot</code>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;" wrap="">sudo apt-get install debootstrap dchroot
</pre>
</li>
<li>Add these line to <code>/etc/schroot/schroot.conf</code>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;" wrap="">[precise]
description=Ubuntu Precise LTS
location=/var/chroot/btranslator
priority=3
users=ubuntu
groups=sbuild
root-groups=root
</pre>
</li>
<li>Bootstrap the chroot with a minimal Ubuntu installation:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;" wrap="">debootstrap --variant=minbase --arch=amd64 precise \
/var/chroot/btranslator http://mirror.rackspace.com/ubuntu/
cp /etc/resolv.conf /var/chroot/btranslator/etc/resolv.conf
cp /etc/apt/sources.list /var/chroot/btranslator/etc/apt/
mount -o bind /proc /var/chroot/btranslator/proc
chroot /var/chroot/btranslator/
apt-get install ubuntu-minimal
apt-get update
apt-get upgrade
apt-get install language-pack-en-base
apt-get install vim aptitude
</pre>
</li>
<li>Install LAMP:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">apt-get install aptitude tasksel
tasksel install lamp-server
</pre>
</li>
<li>Make a startup script <code>/etc/init.d/chroot-btranslator</code> with a content like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">CHROOT=/var/chroot/btranslator
case "$1" in
start)
service apache2 stop
service mysql stop
mount -o bind /proc $CHROOT/proc
mount -o bind /dev $CHROOT/dev
mount -o bind /sys $CHROOT/sys
mount -o bind /dev/pts $CHROOT/dev/pts
chroot $CHROOT/ service mysql start
chroot $CHROOT/ service apache2 start
;;
stop)
chroot $CHROOT/ service apache2 stop
chroot $CHROOT/ service mysql stop
umount $CHROOT/dev/pts
umount $CHROOT/sys
umount $CHROOT/dev
umount $CHROOT/proc
service mysql start
service apache2 start
;;
esac
</pre>
</li>
<li>Make it executable and start it at boot:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">chmod +x /etc/init.d/chroot-btranslator
update-rc.d chroot-btranslator defaults
service chroot-btranslator start
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a _mce_href="http://joshrendek.com/2013/01/securing-ubuntu/#chroot" href="http://joshrendek.com/2013/01/securing-ubuntu/#chroot">http://joshrendek.com/2013/01/securing-ubuntu/#chroot</a></li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" id="postamble" style="font-family: Times, serif; font-size: 16px;">
<div class="author">
Date: 2013-02-14 21:31:49 CET</div>
<div class="creator">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-76135112470459865642012-10-22T01:07:00.000+02:002013-04-25T18:56:36.949+02:00Using NGINX as a Web Server for Drupal<br />
<div style="font-family: Times, serif; font-size: 16px;">
Nginx (engine-x) is a web server that is regarded to be faster than Apache and with a better performance on heavy load. The difference is summed up succinctly in a quote by Chris Lea on the <a href="http://wiki.nginx.org/WhyUseIt">Why Use Nginx?</a> page: "Apache is like Microsoft Word, it has a million options but you only need six. Nginx does those six things, and it does five of them 50 times faster than Apache."</div>
<a name='more'></a><br />
<div style="font-family: Times, serif; font-size: 16px;">
<div style="background-color: white; color: #424037; line-height: 21.59375px; margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Technically speaking, Apache is a process-and-thread-driven application, while Nginx is event-driven. In practice this means that Nginx needs much less memory than Apache to do the work, and also can work faster. There are claims that Nginx, working in a server of 512MB RAM, can handle 10,000 (yes, ten thousands) concurrent requests without problem, while Apache with such a load would just commit harakiri (suicide). Besides, the configuration of Nginx, once you get used to it, is simpler and more intuitive than that of Apache.</div>
<div style="background-color: white; color: #424037; line-height: 21.59375px; margin-bottom: 18px; margin-top: 15px; padding: 0px;">
It seemed like something that I should definitely give a try, since my web server already had performance problems and I cannot afford to pay for increasing its capacity. Here I describe the steps for installing and configuring Nginx to suit the needs of my web application (which is based on Drupal7, running on a 512MB RAM server at Rackspace).</div>
<div style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
Table of Contents</h2>
<div style="margin: 0px; padding: 0px;">
<ol style="margin: 15px 0px 15px 20px; padding: 0px;">
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Installing nginx and php5-fpm</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Configuring php5-fpm</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Configuring nginx</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Configuration for phpMyAdmin</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">SSL (HTTPS) support</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Avoid any DOS attacks</li>
<li style="list-style-type: decimal; margin: 5px 0px 0px; padding: 0px;">Full configuration of the site</li>
</ol>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">1.</span> Installing nginx and php5-fpm</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
In ubuntu server this is very easy:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">sudo apt-get install nginx nginx-doc php5-fpm
update-rc.d apache2 disable
update-rc.d nginx enable
service apache2 stop
service nginx start</pre>
</div>
</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">2.</span> Configuring php5-fpm</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
The main config file (<code style="margin: 0px; padding: 0px;">/etc/php5/fpm/php-fpm.conf</code>) did not need to be changed at all.</div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
On the pool configuration file (<code style="margin: 0px; padding: 0px;">/etc/php5/fpm/pool.d/www.conf</code>) I made only some small modifications:</div>
<ul style="margin: 15px 0px 15px 15px; padding: 0px;">
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">Listen to a unix socket, instead if a TCP socket:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">Other modified options:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">pm.max_requests = 5000
php_flag[display_errors] = on
php_admin_value[memory_limit] = 128M
php_admin_value[max_execution_time] = 90</pre>
</div>
</div>
</li>
</ul>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
I also made these modifications on <code style="margin: 0px; padding: 0px;">/etc/php5/fpm/php.ini</code>:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">cgi.fix_pathinfo=0
max_execution_time = 90
display_errors = On
post_max_size = 16M
upload_max_filesize = 16M
default_socket_timeout = 90</pre>
</div>
</div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Finally restarted the service <em style="margin: 0px; padding: 0px;">php5-fpm</em>:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">service php5-fpm restart</pre>
</div>
</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">3.</span> Configuring nginx</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
On ubuntu, the configuration of Nginx is located at <code style="margin: 0px; padding: 0px;">/etc/nginx/</code>.</div>
<ul style="margin: 15px 0px 15px 15px; padding: 0px;">
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">Create a configuration file for the website, based on the drupal example configuration file:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">cd /etc/nginx/sites-available/
cp /usr/share/doc/nginx-doc/examples/drupal.gz .
gunzip drupal.gz
mv drupal btranslator_dev
cd /etc/nginx/sites-enabled/
ln -s ../sites-available/btranslator_dev .</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">At <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code> modify <strong style="margin: 0px; padding: 0px;">server<sub style="margin: 0px; padding: 0px;">name</sub></strong> and <strong style="margin: 0px; padding: 0px;">root</strong>, and also add <strong style="margin: 0px; padding: 0px;">access<sub style="margin: 0px; padding: 0px;">log</sub></strong> and <strong style="margin: 0px; padding: 0px;">error<sub style="margin: 0px; padding: 0px;">log</sub></strong>:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">server_name dev.btranslator.org l10n-dev.org.al;
root /var/www/dev.btranslator.org;
access_log /var/log/nginx/btranslator_dev.access.log;
error_log /var/log/nginx/btranslator_dev.error.log info;</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">At <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code>, modify the name of the unix socket at the <strong style="margin: 0px; padding: 0px;">fastcgi<sub style="margin: 0px; padding: 0px;">pass</sub></strong> line:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
# Intercepting errors will cause PHP errors to appear in Nginx logs
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php-fpm.sock;
}</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">At <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code>, add the index line as well, at the root location:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">location / {
index index.php;
try_files $uri $uri/ @rewrite;
}</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">At <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code>, allow only localhost to access txt and log files:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">location ~* \.(txt|log)$ {
allow 127.0.0.1;
deny all;
}</pre>
</div>
</div>
</li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;">At <code style="margin: 0px; padding: 0px;">/etc/nginx/nginx.conf</code>, decrease worker processes to 1 or 2:<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;"># worker_processes 4;
worker_processes 2;</pre>
</div>
</div>
</li>
</ul>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
These modifications are all we need, and then we can <em style="margin: 0px; padding: 0px;">reload</em> or <em style="margin: 0px; padding: 0px;">restart</em> the <em style="margin: 0px; padding: 0px;">nginx</em> service:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">service nginx restart</pre>
</div>
</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">4.</span> Configuration for phpMyAdmin</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Add these lines inside the server section, at <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code>:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;"># Configuration for phpMyAdmin
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}</pre>
</div>
</div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Then reload the nginx service.</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">5.</span> SSL (HTTPS) support</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Add these lines at <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code>:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
. . . . .
}</pre>
</div>
</div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Since SSL connections have some overhead, to make them more efficient, add these lines as well at <code style="margin: 0px; padding: 0px;">/etc/nginx/nginx.conf</code> (in order to increase session timeout and and use less expensive encryption):</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">http {
. . . . .
#keepalive_timeout 65;
keepalive_requests 50;
keepalive_timeout 300;
## Global SSL options
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
. . . . .
}</pre>
</div>
</div>
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Then reload nginx.</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">6.</span> Avoid any DOS attacks</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
In order to avoid any DOS attacks, add these lines at <code style="margin: 0px; padding: 0px;">/etc/nginx/nginx.conf</code></div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">http {
. . . . .
## limit request frequency to 2 requests per second
limit_req_zone $binary_remote_addr zone=one:10m rate=2r/s;
limit_req zone=one burst=5;
. . . . .
}</pre>
</div>
</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">7.</span> Full configuration of the site</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<div style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
A full version of the file <code style="margin: 0px; padding: 0px;">/etc/nginx/sites-enabled/btranslator_dev</code> looks like this:</div>
<div class="CodeRay" style="background-color: #232323; border: 1px solid black; color: #e6e0db; font-family: 'Courier New', Terminal, monospace; font-size: 12px; line-height: 14px; margin: 12px 0px 20px; overflow: auto; padding: 3px 5px;">
<div class="code" style="margin: 0px; padding: 0px;">
<pre style="padding: 0px;">server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
server_name dev.btranslator.org l10n-dev.org.al;
root /var/www-ssl/dev.btranslator.org;
access_log /var/log/nginx/btranslator_dev.access.log;
error_log /var/log/nginx/btranslator_dev.error.log info;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# This matters if you use drush
location = /backup {
deny all;
}
# Very rarely should these ever be accessed outside of your lan
location ~* \.(txt|log)$ {
allow 127.0.0.1;
deny all;
}
# This location block protects against a known attack.
location ~ \..*/.*\.php$ {
return 403;
}
# This is our primary location block.
location / {
index index.php;
try_files $uri $uri/ @rewrite;
expires max;
}
# This will rewrite our request from domain.com/node/1/ to domain.com/index.php?q=node/1
# This could be done in try_files without a rewrite however, the GlobalRedirect
# module enforces no slash (/) at the end of URL's. This rewrite removes that
# so no infinite redirect loop is reached.
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
# If a PHP file is served, this block will handle the request. This block
# works on the assumption you are using php-cgi listening on /tmp/phpcgi.socket.
# Please see the php example (usr/share/doc/nginx/exmaples/php) for more
# information about setting up PHP.
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
# Intercepting errors will cause PHP errors to appear in Nginx logs
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
# The ImageCache module builds an image 'on the fly' which means that
# if it doesn't exist, it needs to be created. Nginx is king of static
# so there's no point in letting PHP decide if it needs to be servered
# from an existing file.
# If the image can't be served directly, it's assumed that it doesn't
# exist and is passed off to PHP via our previous rewrite to let PHP
# create and serve the image.
# Notice that try_files does not have $uri/ in it. This is because an
# image should never be a directory. So there's no point in wasting a
# stat to serve it that way.
location ~ ^/sites/.*/files/imagecache/ {
try_files $uri @rewrite;
}
# As mentioned above, Nignx is king of static. If we're serving a static
# file that ends with one of the following extensions, it is best to set
# a very high expires time. This will generate fewer requests for the
# file. These requests will be logged if found, but not if they don't
# exist.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
# Configuration for phpMyAdmin
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
}</pre>
</div>
</div>
</div>
</div>
<div class="outline-2" style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<h2 style="font-size: 16px; letter-spacing: -1px; margin: 30px 0px 0px; padding: 0px;">
<span class="section-number-2" style="margin: 0px; padding: 0px;">8.</span> Referencies:</h2>
<div class="outline-text-2" style="margin: 0px; padding: 0px;">
<ul style="margin: 15px 0px 15px 15px; padding: 0px;">
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://arstechnica.com/business/2011/11/a-faster-web-server-ripping-out-apache-for-nginx/" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://arstechnica.com/business/2011/11/a-faster-web-server-ripping-out-apache-for-nginx/</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://blog.celogeek.com/201209/202/how-to-configure-nginx-php-fpm-drupal-7-0/" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://blog.celogeek.com/201209/202/how-to-configure-nginx-php-fpm-drupal-7-0/</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://insready.com/blog/build-nginx-php-fpm-apc-memcache-drupal-7-bare-bone-ubuntu-1004-or-debian-5-server" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://insready.com/blog/build-nginx-php-fpm-apc-memcache-drupal-7-bare-bone-ubuntu-1004-or-debian-5-server</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://groups.drupal.org/node/238983" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://groups.drupal.org/node/238983</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://groups.drupal.org/nginx" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://groups.drupal.org/nginx</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://www.howtoforge.com/running-phpmyadmin-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://www.howtoforge.com/running-phpmyadmin-on-nginx-lemp-on-debian-squeeze-ubuntu-11.04</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://nginx.org/en/docs/http/configuring_https_servers.html" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://nginx.org/en/docs/http/configuring_https_servers.html</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://wiki.nginx.org/HttpSslModule" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://wiki.nginx.org/HttpSslModule</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://wiki.nginx.org/HttpLimitReqModule" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://wiki.nginx.org/HttpLimitReqModule</a></li>
<li style="list-style-type: disc; margin: 5px 0px 0px; padding: 0px;"><a href="http://matt.io/technobabble/hivemind_devops_alert:_nginx_does_not_suck_at_ssl/ur" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;">http://matt.io/technobabble/hivemind_devops_alert:_nginx_does_not_suck_at_ssl/ur</a></li>
</ul>
</div>
</div>
<div style="background-color: white; color: #424037; line-height: 21.59375px; margin: 0px; padding: 0px;">
<div class="author" style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #bc7134; margin: 0px; padding: 0px; text-decoration: none;"><dashohoxha gmail.com=""></dashohoxha></a></div>
<div class="date" style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
Date: 2012-10-22 01:00:10 CEST</div>
<div class="creator" style="margin-bottom: 18px; margin-top: 15px; padding: 0px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com1tag:blogger.com,1999:blog-5945244389322428562.post-12181478685342509262012-09-30T18:11:00.000+02:002012-09-30T18:11:52.343+02:00Installing a Clonezilla Server<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="font-family: Times, serif; font-size: 16px; text-align: start;">
Clonezilla Server is used to clone many computers simultaneously across a network. This is done using a DRBL server and computer workstations that can boot from a network.</div>
<a name='more'></a><br />
<div class="outline-4" id="outline-container-1" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h4 id="sec-1">
<span class="section-number-4">1</span> Set a static IP</h4>
<div class="outline-text-4" id="text-1">
Ubuntu by default uses <i>network-manager</i> and automatic (DHCP) configuration for the network card. For a server it better to do manual static (fixed IP) configuration.<br />
First modify <code>/etc/network/interfaces</code> like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.235
netmask 255.255.255.0
gateway 192.168.1.1
</pre>
Then remove the package <code>network-manager</code> and restart networking:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">aptitude purge network-manager
/etc/init.d/networking restart
</pre>
</div>
</div>
<div class="outline-4" id="outline-container-2" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h4 id="sec-2">
<span class="section-number-4">2</span> Add a second IP address (alias) to the same card</h4>
<div class="outline-text-4" id="text-2">
Conezilla is based on the DRBL server (which is a kind of light termal server, whith terminals booting over the network through PXE). The DRBL server itself needs one external network interface (connected to WAN) and at least one internal interface (connected to LAN). However, if we have just one network interface, we can add an alias to it, and use it for the LAN.<br />
Append these lines to <code>/etc/network/interfaces</code>:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">auto eth0:0
iface eth0:0 inet static
name Ethernet alias LAN card
address 192.168.3.235
netmask 255.255.255.0
broadcast 192.168.3.255
network 192.168.3.0
</pre>
Then restart networking: <code>/etc/init.d/networking restart</code><br />
Reference:<br />
<ul>
<li><a href="http://www.virtualhelp.me/linux/509-multiple-ip-adresses-for-network-device">http://www.virtualhelp.me/linux/509-multiple-ip-adresses-for-network-device</a></li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-3" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h4 id="sec-3">
<span class="section-number-4">3</span> Installation on the server</h4>
<div class="outline-text-4" id="text-3">
Here are the steps for installing DRBL/Clonezilla on a Ubuntu Server:<br />
<ol>
<li>Add the key of the DRBL repository to apt:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">wget -q http://drbl.org/GPG-KEY-DRBL -O- | sudo apt-key add -
</pre>
</li>
<li>Create the file <code>/etc/apt/sources.list.d/drbl.list</code> which contains this line:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">deb http://drbl.sourceforge.net/drbl-core drbl stable
</pre>
</li>
<li>Install the package <code>drbl</code>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">apt-get update
apt-get install drbl
</pre>
</li>
<li>Install the DRBL server:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">/opt/drbl/sbin/drblsrv -i
</pre>
For the installation steps see this example: <a href="http://drbl.sourceforge.net/one4all/examples/drblsrv_desktop_example.txt">http://drbl.sourceforge.net/one4all/examples/drblsrv\_desktop\_example.txt</a></li>
<li>Setup the filesystem for the clients<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">/opt/drbl/sbin/drblpush -i
</pre>
</li>
</ol>
Referencies:<br />
<ul>
<li><a href="http://www.upubuntu.com/2012/05/how-to-install-clonezilla-server-on.html">http://www.upubuntu.com/2012/05/how-to-install-clonezilla-server-on.html</a></li>
<li><a href="https://help.ubuntu.com/community/Clonezilla_Server_Edition">https://help.ubuntu.com/community/Clonezilla\_Server\_Edition</a></li>
<li><a href="http://geekyprojects.com/cloning/setup-a-clonezilla-server-on-ubuntu/">http://geekyprojects.com/cloning/setup-a-clonezilla-server-on-ubuntu/</a></li>
<li><a href="http://drbl.sourceforge.net/one4all/">http://drbl.sourceforge.net/one4all/</a></li>
<li><a href="http://drbl.nchc.org.tw/one4all/desktop/download/stable/RELEASE-NOTES">http://drbl.nchc.org.tw/one4all/desktop/download/stable/RELEASE-NOTES</a></li>
</ul>
</div>
</div>
<div id="postamble" style="font-family: Times, serif; font-size: 16px; text-align: start;">
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com1tag:blogger.com,1999:blog-5945244389322428562.post-1966051989598187042012-08-30T20:36:00.001+02:002012-08-30T21:12:33.290+02:00The Digital Signature and the X.509/OpenPGP Authentication Models<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="posterous_autopost">
<div style="text-align: left;">
<span style="font-family: Times, serif; font-size: 16px;">This article explains what is a Digital Signature, why it is an important part of the Digital Identity, and how it works. Then it describes the authenticity and social problems related to the usage of the Digital Signature. It explains as well the two authentication models, X.509 and OpenPGP, that can be used to solve these authenticity problems. Finally it makes a comparison between these two authentication models and their features and tries to explain why the OpenPGP model is better.</span><br />
<a name='more'></a></div>
<div style="font-family: Times, serif; font-size: 16px;">
<h2>
</h2>
<h2>
Table of Contents</h2>
<div>
<ul>
<li>1 Introduction <ul>
<li>1.1 What is the Digital Signature</li>
<li>1.2 Why the Digital Signature is Important</li>
</ul>
</li>
<li>2 How the Digital Signature Works <ul>
<li>2.1 What is a Hash Function</li>
<li>2.2 What is Asymmetric Key Cryptography</li>
<li>2.3 Signing a Digital Document</li>
<li>2.4 Verifying the Digital Signature of a Document</li>
<li>2.5 A Concrete Example</li>
</ul>
</li>
<li>3 Authenticity Verification <ul>
<li>3.1 Where to Find the Public Key</li>
<li>3.2 The Problem of Authenticity</li>
<li>3.3 Verifying and Signing Digital Certificates</li>
<li>3.4 Introducers and Certification Authorities (CAs)</li>
</ul>
</li>
<li>4 The Hierarchical (X.509) Authentication Model</li>
<li>5 The Web-Of-Trust (OpenPGP) Authentication Model <ul>
<li>5.1 Self-Signing Your Own Digital Certificate</li>
<li>5.2 Verifying and Signing Certificates of the Others</li>
<li>5.3 Deciding Whom To Trust</li>
<li>5.4 Deciding About the Validity/Authenticity of a Certificate</li>
<li>5.5 Calculating the Validity/Authenticity of a Certificate</li>
<li>5.6 Digital Notaries</li>
</ul>
</li>
<li>6 Comparing the X.509 and OpenPGP Authentication Models <ul>
<li>6.1 Inflexible vs Flexible and Versatile</li>
<li>6.2 Centralized vs Decentralized and Distributed</li>
<li>6.3 Vulnerable vs Robust and Reliable</li>
</ul>
</li>
<li>7 Conclusion</li>
<li>8 Bibliography</li>
</ul>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">1</span> Introduction</h2>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">1.1</span> What is the Digital Signature</h3>
<div class="outline-text-3">
<br />
Digital Signature means some digital data that are attached to a digital document, which cannot be falsified, and which guaranty the integrity and the authenticity of the document.<br />
<br />
The "integrity" means that the document has not been changed/corrupted since the time that it was digitally signed, either intentionally or by mistake. The "authenticity" means that we can verify and be sure about the person that signed the document (the author of the document).<br />
<br />
So, the Digital Signature on digital documents has the same purpose as the hand- written signature on the hard-copy (printed) documents.<br />
<br />
The digital signature is not related to a scanned version of a hard-copy document which is hand-signed, or to a faxed paper document which is hand-signed, or to a scanned image of the hand-signature which is included to a document or attached to an email. All these methods seem to be intuitive for a digital signature, however they do not fully guaranty the integrity and the authenticity of a document, therefore cannot be used as valid digital signatures.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">1.2</span> Why the Digital Signature is Important</h3>
<div class="outline-text-3">
<br />
Without being able to sign digital documents, they can never be considered official, because we cannot be sure that they are original and we cannot be sure who is the real author (they can be corrupted and manipulated). So, despite using computers, digital systems and digital documents, we always have to rely on the hard copies of the documents and keep them around for official purposes, since we can't fully trust the digital documents. This means that we will never be able to build totally digital systems for institutions and organizations, free from papers and hard-copy documents. For example if a citizen has to interact with a governmental institution and sends some documents online, nevertheless he still has to submit the hard copies of the documents in person, since we can't rely on the authorship and correctness of the digital documents.<br />
<br />
Or if a person sends a document by email to a bank, the bank cannot rely on it, since it cannot be fully sure about the authenticity (real authorship) of the document, that it is not manipulated or corrupted somehow, or that it is not just a trick or deception.<br />
<br />
Only the Digital Signature can guaranty the identity of the author of a document and establish a secure relationship between the people and the digital documents. So, it is an essential tool for enabling/supporting the digital identity, for establishing trust and security on the digital world, and for building a digital society (digital governance, digital business, etc.).</div>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">2</span> How the Digital Signature Works</h2>
<div class="outline-text-2">
<br />
The Digital Signature is based on the hash functions and the so called asymmetric key cryptography (private/public key pairs).</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">2.1</span> What is a Hash Function</h3>
<div class="outline-text-3">
<br />
The job of a hash function is to digest (process) an electronic document and to generate from it an extract. No matter how big is the document, the extract has always the same fixed size. Two different documents cannot produce the same extract. A document that is changed even by a single character will produce a different extract after being digested by the hash function.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">2.2</span> What is Asymmetric Key Cryptography</h3>
<div class="outline-text-3">
<br />
Different from the symmetric cryptography, which uses the same key for both encryption and decryption, asymmetric cryptography uses one key for encryption and a different one for decryption. Each person has a pair of encryption keys; one of them is private (secret) and is known only by the person himself, and the other key is public and is known by everybody. A message that is encrypted by one of the keys, can be decrypted only by the other key of the pair. It is almost impossible to find the private key from the public key that is known by everybody.<br />
<br />
The algorithms that are used for generating a pair of private/public keys and for encrypting and decrypting a message are based on the arithmetic of large prime numbers and calculations with residue classes. It is not difficult to understand them, however this is not the proper place to explain such details. It is enough to know that the asymmetric key cryptography is thought to be quite secure and unbreakable.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">2.3</span> Signing a Digital Document</h3>
<div class="outline-text-3">
<br />
To sign a digital document, these steps are followed:<br />
<ol>
<li>The digital document is digested by the hash function and a digital extract is produced.</li>
<li>The digital extract of the document is encrypted with the private key of the author.</li>
<li>This encrypted extract of the document is the digital signature and it can either be appended to the original document, or can be saved as a separate file.</li>
</ol>
</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">2.4</span> Verifying the Digital Signature of a Document</h3>
<div class="outline-text-3">
<br />
The verification of the digital signature of a document is done like this:<br />
<ol>
<li>The digital document is digested by the hash function and its digital extract is produced.</li>
<li>The digital signature of the document is decrypted with the public key of the author. This gives us the digital extract of the original document.</li>
<li>The digital extract of the current document (from the first step) and the digital extract of the original document (from the second step) are compared. If they are the same, then the signature is good and the document is original. Otherwise the signature is bad and the authenticity of the document cannot be guarantied (most probably it has been corrupted, intentionally or by error).</li>
</ol>
If the two digital extracts compared on the third step are equal, this means that the original document is unmodified (since the digital extract has not changed) and it verifies the authenticity of the author (since his public key is able to decrypt the digital signature correctly).<br />
<br />
If these digital extracts are not equal, either the content of the document has been corrupted (by error or intentionally), or the author of the document is not the one who claims to be, or both. Any of these reasons is enough to discard the document as invalid.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">2.5</span> A Concrete Example</h3>
<div class="outline-text-3">
<br />
Email is a kind of digital document, and it can be signed digitally. Actually it is the document that is most widely used with a digital signature nowadays. This is probably due to the fact that the Internet of today is not secure, and emails can be faked easily, and one cannot be completely sure about its authenticity, unless it is digitally signed.<br />
<br />
Suppose that Alice sends an email to Bob. She signs this email using her private key. Then Bob verifies the signature using the public key of Alice. If the verification is successful, then Bob can be sure that this email cannot have been signed except with the private key of Alice. Since only Alice has her private key, then only she can be the signer (and hence the author) of the message.</div>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">3</span> Authenticity Verification</h2>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">3.1</span> Where to Find the Public Key</h3>
<div class="outline-text-3">
<br />
Consider again the example of the last section, where Alice sends an email to Bob. Where can Bob find the public key of Alice, so that he can verify the authenticity of her message?<br />
<br />
There are several ways that Bob can get her public key. Maybe Alice gave it to him directly, using a removable media or sending it as an attachment. Maybe Alice published it on her website and Bob got it from there. Maybe Alice published it on some public key server and Bob retrieved it from there (and this is the most common case in practice).<br />
<br />
A Public Key Server (PKS) is like a directory server (a dictionary), where you can look up and retrieve the public key of a given person. Alice can upload her public key on a PKS, and Bob (or anyone else that needs to verify her signature) can look up and retrieve this key from there.<br />
<br />
Actually the public key of a person is stored in a digital document that contains also the identity of a person (name, email, address, organization, etc.). This document is called Digital Certificate (or Identity Certificate, or Public Key Certificate). It is the Digital Certificate that is uploaded to a PKS and retrieved from it, and it is the Digital Certificate that makes the relation (connection) between the digital identity of a person and his public key.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">3.2</span> The Problem of Authenticity</h3>
<div class="outline-text-3">
<br />
Here we are faced with a problem. If Bob retrieved the digital certificate of Alice from a PKS, how can he be sure that it is authentic? How can he be sure that this certificate was uploaded there by Alice and the public key in it really belongs to Alice? Probably somebody else uploaded that digital certificate there instead of Alice, with the identity of Alice but with a different public key.<br />
<br />
This is actually a social problem, not a technical one, and it can be solved by social means. Bob can actually call Alice and make sure that the ID of her key is the same as the one that he got from the PKS. Or probably Alice gave Bob a business card where she has also written the ID of her public key, so Bob can check this ID with the ID of the key that he retrieved from the PKS and make sure that it is correct.<br />
<br />
However most of the time we communicate with people that we have never met before and we have no idea who they are. It can be that "Alice" is just a fake identity (a nickname or a fake name, not the name of a real person). Or maybe somebody else uploaded the certificate instead of Alice, pretending to be Alice, and the key in the certificate does not really belong to Alice (is a fake public key).<br />
<br />
If Bob has never met Alice, then how can he be sure about her real identity? How can he be sure that Alice is a real person and that the messages that he gets are really coming from her and not from somebody pretending to be her? In other words, how can Bob be sure that the digital certificate of Alice, that he gets from the PKS, is authentic?<br />
<br />
Just verifying that the signature of the message is correct is not enough. We need to verify also that the digital certificate that was used for the signature is authentic.<br />
<br />
Again, this is a social problem and cannot be solved only by technical means. It can be solved only by a combination of social and technical procedures.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">3.3</span> Verifying and Signing Digital Certificates</h3>
<div class="outline-text-3">
<br />
Suppose that Chloe has checked the digital certificate of Alice and is sure that:<br />
<ol>
<li>Alice is a real person and the digital identity on her digital certificate corresponds to her real-life identity and is correct.</li>
<li>The public key in the digital certificate is the correct one (the one that belongs to Alice).</li>
</ol>
How can Chloe check and verify the digital identity of Alice (first point above)? If Chloe does not know Alice personally, she can ask to meet her in person, check her identity documents (passport, identity card, driver license, etc.) and make sure that the digital identity of Alice (name, birthday, etc.) corresponds to the real-life identity. For checking and verifying the public key (second point above), Chloe has to get from Alice the fingerprint or ID of her public key, compare it with the one on the digital certificate, and make sure that it is the same.<br />
<br />
Now that Chloe has verified that the digital certificate of Alice is authentic, she can sign it. A digital certificate is just a digital document, so it can be signed with a digital signature.<br />
<br />
By signing the digital certificate of Alice, Chloe testifies that it is correct and valid, which means that the digital identity is authentic and the public key really belongs to Alice. The digital signature of Chloe also guaranties that the information on the digital certificate has not been changed since the time that she verified and signed it.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">3.4</span> Introducers and Certification Authorities (CAs)</h3>
<div class="outline-text-3">
<br />
If Bob has full trust on Chloe about checking and verifying the information of digital certificates, then he can be sure that the digital certificate of Alice is authentic and valid, without having to check and verify it himself.<br />
<br />
So, Bob asserts (derives) the validity/authenticity of the digital certificate of Alice by trusting a third party, which is Chloe. Bob can trust as well any other digital certificates that Chloe has signed. In such a case Chloe is called an "introducer" for Bob.<br />
<br />
If Chloe verifies and signs a lot of digital certificates and a lot of people trust the certificates signed by Chloe, then Chloe is called a Certification Authority (CA).</div>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">4</span> The Hierarchical (X.509) Authentication Model</h2>
<div class="outline-text-2">
<br />
The X.509 authentication model is a hierarchical one. The digital certificate of a person is verified and signed by a certification authority (CA), the digital certificate of this CA is verified and signed by a higher level CA, and so on until we reach a root CA, whose digital certificate is self-signed (has signed himself his own digital certificate).<br />
<br />
For example, if Bob receives a message signed with the digital certificate of Alice, he will notice that this digital certificate is verified and signed by CA1, which in turn is verified and signed by CA2, which is verified and signed by RCA (a root CA). Bob just has to check that the certificate of the root CA is correct (valid and authentic), and then he has to trust that each of RCA, CA1 and CA2 have done the verification and signing properly. He doesn't have to check and verify the certificate of Alice directly. This chain verification is usually done automatically by the software that Bob uses.<br />
<br />
The digital certificate (public key) of the root authority has to be widely known and easily verifiable. And also Bob has to trust it (actually it turns out that Bob does not have much choice on this, because other people have decided that Bob should trust it). The validation of a certificate is based on the trust that Bob has that the root CA and each of the CAs have done their job properly (checking and verifying the certificates of the next level).<br />
<br />
CAs are usually commercial, but large institutions or government entities may have their own CAs as well. There are about 50 root CAs that are known worldwide.</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">5</span> The Web-Of-Trust (OpenPGP) Authentication Model</h2>
<div class="outline-text-2">
<br />
The OpenPGP standard uses a non-hierarchical, decentralized authentication model that is called Web-Of-Trust.</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.1</span> Self-Signing Your Own Digital Certificate</h3>
<div class="outline-text-3">
<br />
In the OpenPGP model each person acts as a root CA and first of all self-signs his own digital certificate (to protect it from any modification and forgery). For example Alice signs her own certificate and Bob signs his own.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.2</span> Verifying and Signing Certificates of the Others</h3>
<div class="outline-text-3">
<br />
Second, each of them can sign the certificates of the people, which they have personally checked and verified. Verification includes both making sure that the digital identity matches the real-life identity of the person, and making sure that the public key in the certificate is the correct one that belongs to this person. This certificate verification and signing can be mutual as well, for example Alice signs the certificate of Bob, and Bob signs the certificate of Alice.<br />
<br />
When Alice signs the certificate of Bob, usually she makes public this signature by uploading the signed certificate on a PKS. This lets everybody know that she has checked and verified the digital certificate of Bob and that she guaranties that this certificate is authentic and valid.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.3</span> Deciding Whom To Trust</h3>
<div class="outline-text-3">
<br />
Next, each person decides who are the people that he can trust about making correct verification of others' certificates, and how much he can trust them. The trust levels that are defined by the OpenPGP standard are: <em>unknown</em> (default), <em>none</em>, <em>marginal</em>, <em>full</em>, <em>ultimate</em>. These trust values are not about how trustable is this person in the real life, but rather about the ability of the person to make correct verification of digital certificates, before signing them.<br />
<br />
For example the trust value <em>marginal</em> means that you believe that this person sometimes may not check and verify carefully the details of a certificate, before signing it. The trust value <em>full</em> means that you believe that this person is very careful when signing certificates. The trust value <em>ultimate</em> means that you believe that this person is so careful when checking and signing certificates, that he almost never makes mistakes.<br />
<br />
The trust level that one assigns to a person is subjective and can be different from one person to another. For example Alice may have full trust on Bob, however Chloe may think that Bob can be trusted only marginally. The trust level is also private, which means that it is relevant only to the person who assigns it, and it is not published on any servers.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.4</span> Deciding About the Validity/Authenticity of a Certificate</h3>
<div class="outline-text-3">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-MTCXFnQjMAE/UD-1MhjTTpI/AAAAAAAAAvc/2PSpaGj7-WU/s1600/signatures.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-MTCXFnQjMAE/UD-1MhjTTpI/AAAAAAAAAvc/2PSpaGj7-WU/s1600/signatures.jpg" /></a></div>
The figure shows a web of trust rooted at Alice. The graph illustrates who has signed who's certificate.<br />
<br />
Alice is sure that the certificates of Blake and Dharma are valid, since she has verified and signed them herself.<br />
<br />
If Alice has full trust on Dharma, then she would consider valid the certificates of Chloe and Fransis as well. She has not verified them herself, but Dharma has verified and signed them and Alice has full trust on the ability of Dharma to correctly verify and sign digital certificates.<br />
<br />
In case that Alice has only marginal trust on Blake and Dharma, then she cannot be really sure about the validity of the Francis' certificate, although Dharma has signed it. However, she can be almost sure about the validity of the Chloe's certificate. Both Blake and Dharma have verified and signed it, so the possibility of both of them being deceived (or corrupted, mistaken) is small.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.5</span> Calculating the Validity/Authenticity of a Certificate</h3>
<div class="outline-text-3">
<br />
The decision on which certificate can be considered fully valid, or partially valid, or non-valid, is actually done automatically by the software that is used for verifying the signature. The software makes this decision based on who has signed who's certificate, on the trust value assigned to each of the people on the web of trust, and applying certain rules that are used to calculate the validity (authenticity) of a certificate. Such a rule can be for example: a certificate that is signed by at least three marginally trusted people can be considered fully valid.<br />
<br />
The validation rules are customizable and can be different for each person, in order to fit the security requirements of everybody. For example, if Alice does not have any high security needs, and she lives in a friendly (not hostile) environment, then she may decide that even two marginally trusted signatures are enough to consider a certificate fully valid. However, if she has high security requirements and she lives in a rather hostile environment, then she can decide that at least five marginally trusted signatures should be required, so that a certificate that she has not verified herself can be considered valid. In this case, since she has decided to depend less on the verifications done by the others, she has to do more verifications on her own.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">5.6</span> Digital Notaries</h3>
<div class="outline-text-3">
<br />
Sometimes there are people who do a great many of verification and signing of the others' digital certificates, even on a full time bases, and they are trusted by everybody (or at least a lot of people). These people play the role of a CA (Certification Authority) in the OpenPGP model.<br />
<br />
Such people can be for example the head of the IT department in a company or institution. Or they can be people approved, verified and authorized by the government to offer this kind of service to the citizens. In this case they can also be called Digital Notaries and they may offer other Digital Services as well, besides verifying and signing digital certificates.<br />
<br />
The Digital Notaries can also be held responsible in front of law for the correctness and truthfulness of the verifications and signatures that they make (as well as for other digital or non-digital services that they may offer). This accountability can be very useful for increasing their responsibility, as well as for increasing the trust of people on them and the health and reliability of the web-of-trust system as a whole.</div>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">6</span> Comparing the X.509 and OpenPGP Authentication Models</h2>
<div class="outline-text-2">
<br />
The digital certificates of both standards, X.509 and OpenPGP, are very similar in content and they are based on the same principles (of asymmetric cryptography, private/public key pair, etc.). However their authentication models are different and not interoperable. This means that a digital certificate that is recognized as valid and authentic by one of them, can not be recognized as such by the other.<br />
<br />
However both of them can be used concurrently (at the same time) without interfering with each-other. This means that a person can have one certificate of type X.509 and another of type OpenPGP at the same time, and use either one of them or the other, as needed. This is also facilitated by the fact that most of the software that are used for digital signatures support both of these standards.</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">6.1</span> Inflexible vs Flexible and Versatile</h3>
<div class="outline-text-3">
<br />
If we compare the structure of the authentication models of the X.509 and the OpenPGP standards, we will notice that the first one closely resembles a tree (is hierarchical, like the structure of the private/governmental organizations), while the second one resembles a web or mesh (like the structure of the Internet).<br />
<br />
A mesh is a much more flexible structure than a tree, because a tree structure is just a special case of a mesh structure.<br />
<br />
In the web-of-trust authentication model of OpenPGP there can be CAs as well (like in the case of Digital Notaries that we have discussed previously). If many people choose to fully trust the same CA for checking the validity/authenticity of the others certificates (and they all configure their own copies of the OpenPGP client software to trust that CA), then the OpenPGP model acts just like the X.509 model. In fact, the web model of OpenPGP is a proper superset of the hierarchical model of X.509.<br />
There is no situation in the X.509 model that cannot be handled exactly the same way in the OpenPGP model. But OpenPGP can do much more.<br />
<br />
In the X.509 model the set of trusted root CAs is fixed and predetermined. The users have no choice and can make no decision whether to trust them or not. This is so true that these CAs are "baked into" the major software that uses digital certificates (e.g. browsers). On the OpenPGP model, on the other hand, the users can decide themselves whom to trust and how much to trust them.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">6.2</span> Centralized vs Decentralized and Distributed</h3>
<div class="outline-text-3">
<br />
We can notice as well that the hierarchical model is centralized, while the web-of-trust model is distributed and decentralized. This is related to who is responsible for ensuring the correctness, authenticity and validity of the certificates, the security, trustability and reliability of the whole system, etc.<br />
<br />
On the hierarchical model this responsibility falls on some central authority (the root CA), and on the sub-authorities (CAs) that it approves. On the web-of-trust model this responsibility falls on everybody participating on the system, since each of them helps to verify and validate the certificates of the others. So, on the web-of-trust model, each person that holds a digital certificate is verified by the others and helps to verify the others at the same time. This is a more democratic model, that encourages the responsibility and the participation of the citizens.</div>
</div>
<div class="outline-3">
<h3>
<span class="section-number-3"><br /></span></h3>
<h3>
<span class="section-number-3">6.3</span> Vulnerable vs Robust and Reliable</h3>
<div class="outline-text-3">
<br />
The decentralized/distributed model is also more robust and reliable than the hierarchical model.<br />
The hierarchical model has just a single point-of-failure that has to be watched, protected and guarded very carefully, since it is a clear target of attack. This is the root CA. In case that its security is compromised or corrupted some day, then the security of the whole system is compromised and all of the digital certificates of the system are rendered invalid.<br />
<br />
This doesn't have to be a technical failure (for example some hackers breaking into the system), it can be a social corruption as well (and this can be even more likely than a technical failure). This risk is amplified by the fact that most of the CAs are commercial. Matt Blaze once made the cogent observation that commercial CAs will protect you against anyone who that CA refuses to accept money from!<br />
<br />
The distributed model, on the other hand, is much more difficult to corrupt because each participant is a little CA on its own. Maybe some of them can be corrupted for some time, but it is quite difficult to corrupt many or most of them at the same time. In any case, there can be inflicted only local damages, the whole system will survive the attack, and with time it can auto-correct and heal itself gradually.</div>
</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">7</span> Conclusion</h2>
<div class="outline-text-2">
<br />
It is quite easy to understand the concept of Digital Signatures and the basics of how it works. The Digital Signature is so important that it will become an inevitable part of our future digital societies.<br />
A very important aspect of the digital signature is verification of its authenticity. It happens that this is more a social problem than a technical one, so it can be solved correctly only by the right combination of social and technical means.<br />
<br />
Currently, there are two models (or infrastructures) for solving the authentication problem. One of them is the Hierarchical model (X.509 standard), and the other one is the Web-Of-Trust model (OpenPGP standard). The Web-Of-Trust model is more flexible and advanced than the Hierarchical model, but it requires that everybody that participates in it takes responsibility and makes decisions for himself.<br />
However I think that the Web-Of-Trust is the right approach, because the personal privacy and security are, by definition, personal responsibilities, and they cannot be outsourced.</div>
</div>
<div class="outline-2" style="font-family: Times, serif; font-size: 16px;">
<h2>
<span class="section-number-2"><br /></span></h2>
<h2>
<span class="section-number-2">8</span> Bibliography</h2>
<div class="outline-text-2">
<ul>
<li><a href="http://en.wikipedia.org/wiki/Digital_signature">http://en.wikipedia.org/wiki/Digital\_signature</a></li>
<li><a href="http://en.wikipedia.org/wiki/Public_key">http://en.wikipedia.org/wiki/Public\_key</a></li>
<li><a href="http://en.wikipedia.org/wiki/Digital_certificate">http://en.wikipedia.org/wiki/Digital\_certificate</a></li>
<li><a href="http://en.wikipedia.org/wiki/X.509">http://en.wikipedia.org/wiki/X.509</a></li>
<li><a href="http://en.wikipedia.org/wiki/Web_of_trust">http://en.wikipedia.org/wiki/Web\_of\_trust</a></li>
<li><a href="http://www.youdzone.com/signature.html">http://www.youdzone.com/signature.html</a></li>
<li><a href="http://www.gnupg.org/gph/en/manual.html">http://www.gnupg.org/gph/en/manual.html</a></li>
<li><a href="http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html">http://www.cryptnet.net/fdp/crypto/keysigning\_party/en/keysigning\_party.html</a></li>
<li><a href="http://www.openpgp.org/technical/whybetter.shtml">http://www.openpgp.org/technical/whybetter.shtml</a></li>
<li><a href="http://enigmail.mozdev.org/">http://enigmail.mozdev.org/</a></li>
<li><a href="http://www.gpg4win.org/">http://www.gpg4win.org/</a></li>
</ul>
</div>
</div>
<div style="font-family: Times, serif; font-size: 16px;">
<div class="author">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com"><dashohoxha@gmail.com></a></div>
<div class="date">
Date: 20 Sep, 2011</div>
<div class="creator">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com1tag:blogger.com,1999:blog-5945244389322428562.post-79339438403293078372012-08-30T14:07:00.000+02:002012-08-30T14:18:08.129+02:00Virtual Machines on a CentOS Host<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: left;">
<span style="font-family: Times, serif; font-size: 16px; text-align: start;">A powerful rack server can be used as a host for installing lots of virtual machines, and it can be used as a data storage as well. This article will describe how to use such a server, installed with CentOS, as a host for virtual machines.</span></div>
<a name='more'></a><br />
<div style="text-align: left;">
<span style="font-family: Times, serif; font-size: 16px; text-align: start;"><br /></span></div>
<div style="font-family: Times, serif; font-size: 16px; text-align: start;">
The server is a <a href="http://www.supermicro.com/manuals/motherboard/C606_602/MNL-1298.pdf">SuperMicro X9DRL-3F/IF</a> with these parameters:</div>
<table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups" style="border-collapse: collapse; color: black; font-family: Times, serif; font-size: 16px;"><caption></caption><colgroup><col align="left"></col><col align="left"></col></colgroup><tbody>
<tr><td style="vertical-align: top;">RAM</td><td style="vertical-align: top;">32GB</td></tr>
<tr><td style="vertical-align: top;">HDD</td><td style="vertical-align: top;">2x320GB + 2x3TB</td></tr>
<tr><td style="vertical-align: top;">Network</td><td style="vertical-align: top;">2 Gb interfaces + 1 KVM/IMPI interface</td></tr>
</tbody></table>
<div style="font-family: Times, serif; font-size: 16px; text-align: start;">
<br /></div>
<div style="font-family: Times, serif; font-size: 16px; text-align: start;">
The first two disks (2x320GB) are used in RAID1 configuration to keep the host and the virtual servers, and the 2x3TB disks are used for the data.</div>
<div id="table-of-contents" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2>
<br /></h2>
<h2>
Table of Contents</h2>
<div id="text-table-of-contents">
<ol>
<li>Installation of CentOS</li>
<li>Disk partitioning and formating</li>
<li>Managing partitions with LVM:</li>
<li>Creating bridged interfaces on CentOS</li>
<li>Installing KVM and libvirt</li>
</ol>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2 id="sec-1">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-1">
<span class="section-number-2">1.</span> Installation of CentOS</h2>
<div class="outline-text-2" id="text-1">
During boot-up, we press Ctrl+I and configure a RAID1 device with the first two disks (320Gb each).<br />
Installation was done with <i>CentOS-6.2-x86_64-minimal.iso</i> (standard installation, where the installer automatically partitions the first disk drive (the raid one)). The standard installation of CentOS is very easy (with a GUI interface), it use RAID automatically, partitions the disk automatically, and uses LVM for the partitions.</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2 id="sec-2">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-2">
<span class="section-number-2">2.</span> Disk partitioning and formating</h2>
<div class="outline-text-2" id="text-2">
We have two disks of 3TB each that we need to partition and manage, however the partition tables of type <b>msdos</b> (most commonly used) cannot manage more than 2TB of disk space. The solution is to use partion tables of type <b>GPT</b>. Fortunately, the partition editor (parted) of Linux, supports them quite well.<br />
The GPT partitions can also have more than 4 primary partitions, so there is no need for extended partitions and tricks like this. I split both of the disks in <b>6</b>primary partitions of <b>500GB</b> each, formating them with <b>ext4</b>. Later, I am going to manage these partitions with <b>LVM</b>.<br />
The steps below show roughly how I did the partitioning:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">yum install parted
parted /dev/sdc
parted /dev/sdd
</pre>
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">(parted) print
(parted) mklabel gpt
(parted) mkpart primary 0.0GB 500.0GB
(parted) mkpart primary 500.0GB 1.0TB
(parted) mkpart primary 1.0TB 1.5TB
(parted) mkpart primary 1.5TB 2.0TB
(parted) mkpart primary 2.0TB 2.5TB
(parted) mkpart primary 2.5TB 3.0TB
(parted) print
Model: ATA ST3000DM001-9YN1 (scsi)
Disk /dev/sdd: 3001GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 500GB 500GB primary
2 500GB 1000GB 500GB primary
3 1000GB 1500GB 500GB primary
4 1500GB 2000GB 500GB primary
5 2000GB 2500GB 500GB primary
6 2500GB 3001GB 501GB primary
(parted)
</pre>
And this is how I formated them with <b>ext4</b>:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">mkfs.ext4 /dev/sdc1
mkfs.ext4 /dev/sdc2
mkfs.ext4 /dev/sdc3
mkfs.ext4 /dev/sdc4
mkfs.ext4 /dev/sdc5
mkfs.ext4 /dev/sdc6
for i in 1 2 3 4 5 6; do mkfs.ext4 /dev/sdd$i ; done
</pre>
Referencies:<br />
<ul>
<li><a href="http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html">http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html</a></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2 id="sec-3">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-3">
<span class="section-number-2">3.</span> Managing partitions with LVM</h2>
<div class="outline-text-2" id="text-3">
One of the best advantages of Logical Volume Management (<b>LVM</b>) is the flexibility. LVM disks and partitions can be resized easily, when needed. Actually, in the terminology of LVM, logical disks are called <i>Volume Groups</i> (<b>VG</b>), and logical partitions are called Logical Volumes (<b>LV</b>). We can create several VGs, and inside each of them we can create LVs. The sizes of VGs and LVs are flexible, we can extend them later, if needed.<br />
Let's create a <i>volume group</i> named <i>vg_data</i> by including some Physical Volumes (<b>PV</b>, physical disk partitions) to it:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">vgdisplay
vgcreate vg_data /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sdd2
vgdisplay
</pre>
Then we can extend it by adding some more PVs (partitions) to it:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">vgdisplay
vgextend vg_data /dev/sdc3 /dev/sdc4 /dev/sdd3 /dev/sdd4
vgdisplay
</pre>
Now, inside the VG named <i>vg_data</i>, let's create an LV (logical partition) named <b>/dev/vg_data/lv_mirror</b>, of size <b>1TB</b>:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">lvdisplay
lvcreate vg_data -L 1T -n /dev/vg_data/lv_mirror
lvdisplay
</pre>
We can create an <b>ext4</b> filesystem on it like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">mkfs.ext4 -L mirror /dev/vg_data/lv_mirror
</pre>
Another LV can be created like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">lvcreate vg_data -L 500G -n /dev/vg_data/lv_cache
lvdisplay
</pre>
</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2 id="sec-4">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-4">
<span class="section-number-2">4.</span> Creating bridged interfaces on CentOS</h2>
<div class="outline-text-2" id="text-4">
We want the virtual machines to be connected directly to the network, and for this reason we should create bridged interfaces on the host system. We create a bridged interface for each of the network interfaces of the server. The steps below show how it can be done on CentOS.<br />
<ul>
<li>Edit <code>/etc/sysconfig/network-scripts/ifcfg-eth0</code>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">DEVICE="eth0"
HWADDR="00:25:90:76:92:AA"
ONBOOT="yes"
BRIDGE="br0"
</pre>
</li>
<li>Edit <code>/etc/sysconfig/network-scripts/ifcfg-eth1</code>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">DEVICE="eth1"
HWADDR="00:25:90:76:92:AB"
ONBOOT="yes"
BRIDGE="br1"
</pre>
</li>
<li>Edit <code>/etc/sysconfig/network-scripts/ifcfg-br0</code>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">DEVICE="br0"
TYPE="Bridge"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="192.168.100.254"
NETMASK="255.255.255.0"
DELAY="0"
</pre>
</li>
<li>Edit <code>/etc/sysconfig/network-scripts/ifcfg-br1</code>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">DEVICE="br1"
TYPE="Bridge"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR="192.168.10.254"
NETMASK="255.255.255.0"
DELAY="0"
GATEWAY="192.168.10.1"
</pre>
</li>
<li>Restart the network: <code>service network restart</code></li>
</ul>
Referencies:<br />
<ul>
<li><a href="http://www.cyberciti.biz/faq/rhel-linux-kvm-virtualization-bridged-networking-with-libvirt/">http://www.cyberciti.biz/faq/rhel-linux-kvm-virtualization-bridged-networking-with-libvirt/</a></li>
<li><a href="http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html">http://www.centos.org/docs/5/html/Deployment\_Guide-en-US/s1-networkscripts-interfaces.html</a></li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<h2 id="sec-5">
<span class="section-number-2"><br /></span></h2>
<h2 id="sec-5">
<span class="section-number-2">5.</span> Installing KVM and libvirt</h2>
<div class="outline-text-2" id="text-5">
<ul>
<li>First check if the CPU supports hardware virtualization:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">egrep '(vmx|svm)' --color=always /proc/cpuinfo
</pre>
</li>
<li>Install <i>kvm</i> and <i>libvirt</i>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum install kvm libvirt python-virtinst qemu-kvm
</pre>
</li>
<li>Modify <code>/etc/libvirt/libvirtd.conf</code> and uncomment <code>mdns_adv = 0</code>. Then restart <i>libvirtd</i> and check it with <i>virsh</i>:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">service libvirtd restart
virsh -c qemu:///system list
</pre>
</li>
<li>Add a user that can manage the virtual machines:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">useradd virtadmin
passwd virtadmin
usermod -a -G kvm virtadmin
</pre>
We would like to be able to manage the virtual machines remotely (for example with virt-manager), and it is not a good idea to use the <b>root</b> account for doing it. So we create another account, <b>virtadmin</b>, that has permissions to manage the virtual machines. These permissions are assigned to it simply by adding it to the group <b>kvm</b>.</li>
<li>Set <code>SELINUX=disabled</code> on <code>/etc/selinux/config</code> and then reboot:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;"># This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
</pre>
</li>
<li>For easy backup, we keep all the configurations and images on a separate directory, called <code>/systems</code> (which can also be on a separate partition). Move all the configurations and settings to <code>/systems</code>, like this:<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">mkdir /systems
mv /etc/libvirt /systems/etc
ln -s /systems/etc /etc/libvirt
mv /var/lib/libvirt/ /systems/var
ln -s /systems/var/ /var/lib/libvirt
mkdir /systems/images/
</pre>
Modify <code>/systems/etc/storage/default.xml</code> like this:<br />
<pre class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;"><!-- <path>/var/lib/libvirt/images</path> -->
<path>/systems/images</path>
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a href="http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-6.2-server">http://www.howtoforge.com/virtualization-with-kvm-on-a-centos-6.2-server</a></li>
<li><a href="http://www.howtoforge.com/how-to-install-kvm-and-libvirt-on-centos-6.2-with-bridged-networking">http://www.howtoforge.com/how-to-install-kvm-and-libvirt-on-centos-6.2-with-bridged-networking</a></li>
<li><a href="http://quags.net/archives/53">http://quags.net/archives/53</a></li>
</ul>
</div>
</div>
<div id="postamble" style="font-family: Times, serif; font-size: 16px; text-align: start;">
<div class="author">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com"><dashohoxha gmail.com="gmail.com"></dashohoxha></a></div>
<div class="date">
Date: 2012-08-30 13:55:51 CEST</div>
<div class="creator">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com1tag:blogger.com,1999:blog-5945244389322428562.post-47962329390993517682012-08-28T12:23:00.000+02:002012-08-28T12:47:37.087+02:00B-Translator as a Software Engineering Project<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: left;">
<span style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">The project B-Translator will be presented, trying to illustrate through it some software development/engineering concepts and practices (how they are actually applied in this project).</span></div>
<a name='more'></a><br />
<div id="table-of-contents" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
Table of Contents</h2>
<div id="text-table-of-contents">
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li><span style="color: #0088cc;">1 Introduction</span></li>
<li><span style="color: #0088cc;">2 Conception of the software</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">2.1 The problems that B-Translator tries to solve and its goals</span></li>
<li><span style="color: #0088cc;">2.2 Are there any existing alternatives to B-Translator?</span></li>
<li><span style="color: #0088cc;">2.3 The meaning of B-Translator</span></li>
</ul>
</li>
<li><span style="color: #0088cc;">3 Description of its features and functionality</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">3.1 The features of B-Translator</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">3.1.1 Open access</span></li>
<li><span style="color: #0088cc;">3.1.2 Authenticated voting</span></li>
<li><span style="color: #0088cc;">3.1.3 Tracking votes</span></li>
<li><span style="color: #0088cc;">3.1.4 Highly customizable</span></li>
<li><span style="color: #0088cc;">3.1.5 Evaluation algorithms</span></li>
<li><span style="color: #0088cc;">3.1.6 Detailed and comprehensive reporting and statistics</span></li>
<li><span style="color: #0088cc;">3.1.7 Integration with the existing workflow of the project translations</span></li>
</ul>
</li>
</ul>
</li>
<li><span style="color: #0088cc;">4 Analyzing the functionality in more details</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">4.1 The actors and use-cases of B-Translator</span></li>
<li><span style="color: #0088cc;">4.2 Interfaces</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">4.2.1 Suggestion interface</span></li>
<li><span style="color: #0088cc;">4.2.2 Query interface</span></li>
<li><span style="color: #0088cc;">4.2.3 User configuration interface</span></li>
<li><span style="color: #0088cc;">4.2.4 Export and import interfaces</span></li>
<li><span style="color: #0088cc;">4.2.5 Admin interfaces</span></li>
</ul>
</li>
</ul>
</li>
<li><span style="color: #0088cc;">5 Designing the software</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">5.1 The DB schema of B-Translator</span></li>
<li><span style="color: #0088cc;">5.2 API</span></li>
</ul>
</li>
<li><span style="color: #0088cc;">6 Construction (implementation/development)</span></li>
<li><span style="color: #0088cc;">7 Managing the project</span></li>
<li><span style="color: #0088cc;">8 Documentation</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">8.1 Installation of B-Translator</span></li>
<li><span style="color: #0088cc;">8.2 How B-Translator works</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">8.2.1 Build a dictionary of l10n strings</span></li>
<li><span style="color: #0088cc;">8.2.2 Collect feedback from users/reviewers</span></li>
<li><span style="color: #0088cc;">8.2.3 Export the revised translations</span></li>
<li><span style="color: #0088cc;">8.2.4 The process/workflow for a project without translation</span></li>
<li><span style="color: #0088cc;">8.2.5 Exporting only the latest suggestions (diffs)</span></li>
<li><span style="color: #0088cc;">8.2.6 The process/workflow for an integrated translation</span></li>
</ul>
</li>
<li><span style="color: #0088cc;">8.3 Drupal interfaces (paths)</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">8.3.1 translations[/<lng>/<sguid>]</span></li>
<li><span style="color: #0088cc;">8.3.2 translations/search?lng=..&limit=..&mode=..&words=..</span></li>
<li><span style="color: #0088cc;">8.3.3 translations/project</span></li>
<li><span style="color: #0088cc;">8.3.4 translations/user_settings</span></li>
<li><span style="color: #0088cc;">8.3.5 translations/admin</span></li>
</ul>
</li>
<li><span style="color: #0088cc;">8.4 Importing and exporting translation files</span><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><span style="color: #0088cc;">8.4.1 Translation files</span></li>
<li><span style="color: #0088cc;">8.4.2 Importing</span></li>
<li><span style="color: #0088cc;">8.4.3 Exporting</span></li>
<li><span style="color: #0088cc;">8.4.4 Snapshots and diffs</span></li>
<li><span style="color: #0088cc;">8.4.5 Misc</span></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-1" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">1</span> Introduction</h2>
<div class="outline-text-2" id="text-1">
<div style="margin-bottom: 10px;">
Software Engineering is an interdisciplinary branch between programing and project management, that tries to make efficient and effective the process of developing new software, by identifying and trying to use principles and practices that have proved to be successful on the past projects. It was born as a response to the failures in software projects for a long time.</div>
<div style="margin-bottom: 10px;">
Programing is an art, and so is the project management. As a result software engineering cannot be an exact discipline, although the word 'engineering' seems to imply a set of well defined steps and rules. However, some guiding principles can be useful when applied wisely to the current situation. Anyway, the most important factor still remains the experience: you are good at managing software projects if you have enough experience with doing it.</div>
<div style="margin-bottom: 10px;">
There are several models (or methods, or approaches, or paradigms) for managing a software project. The simples (and oldest) one is the waterfall model. The basic steps of the waterfall model are these:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>requirements</li>
<li>analysis</li>
<li>design</li>
<li>implementation</li>
<li>testing</li>
<li>deployment</li>
<li>maintenance</li>
</ul>
<div style="margin-bottom: 10px;">
These steps should be performed in the life cycle of every software development project. However the waterfall model is not very realistic, because in practice is very difficult to get everything right with the first attempt. For example while gathering the software requirement, most probably we can miss something; or maybe later there can be a request for updating the requirements.</div>
<div style="margin-bottom: 10px;">
A better approach is the Iterative and Incremental model. The basic steps are the same, however the development is performed in several cycles, with each of these steps performed in almost each cycle. During the cycles the software is improved from an initial prototype to a full featured product.</div>
<div style="margin-bottom: 10px;">
There are other methodologies and variations as well, like Agile Software Development, Extreme Programing, etc. However the bottom line remains that the best method to use depends on the concrete software that is to be developed, and any method that can be used should be adopted to match the current case.</div>
<div style="margin-bottom: 10px;">
Therefore, here I will describe what I have done on the project B-Translator, trying to identify the principles and practices of Software Engineering that are used, instead of trying to fit this project to one of the standard approaches.</div>
</div>
</div>
<div class="outline-2" id="outline-container-2" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-2" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">2</span> Conception of the software</h2>
<div class="outline-text-2" id="text-2">
<div style="margin-bottom: 10px;">
Before a software starts to be built, the idea of such a software has to come somehow to mind. The idea for building such a software usually comes to mind because there is some problem to be solved, or some need to be fulfilled, which for some reasons, cannot be done (or cannot be done properly) by the existing software. Before anything else, a software engineer/developer should have a clear idea of the problem (or problems) that the software is trying to solve, and the overall aim (or goal) or the software.</div>
</div>
<div class="outline-3" id="outline-container-2.1">
<h3 id="sec-2.1" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">2.1</span> The problems that B-Translator tries to solve and its goals</h3>
<div class="outline-text-3" id="text-2.1">
<div style="margin-bottom: 10px;">
First of all, B-Translator is a software that helps to get feedback about l10n (localization, translations of programs into other languages). It also helps to unify all the different translations and to ensure consistency among the translations. It is intended to be used for the translations of programs into Albanian, but it can be used for any other languages as well.</div>
<div style="margin-bottom: 10px;">
The motivation for developing such a software is that the traditional (current) l10n work-flow requires highly dedicated people, and does not allow (or at least does not facilitate) small contributions from random people that do not have such a high dedication, determination and enough free time.</div>
<div style="margin-bottom: 10px;">
Also, the process of reviewing and correcting translations is not easy and does not facilitate the feedback from the users of the translated programs. Although the translators are usually very good and professional, they can make mistakes too, and sometimes they may miss the best translation for some certain terms. Some feedback from the crowd of the users would be more than welcome, if there are tools to collect and facilitate it.</div>
<div style="margin-bottom: 10px;">
Another problem with translations is that sometimes they are not consistent. The same string has different translations in different programs, and sometimes even the same translator may have provided different translations for the same string in different cases. This happens mainly because each program/project has its own translations and there is no central repository for all the translations.</div>
<div style="margin-bottom: 10px;">
To summarize, the goals of this software are these:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>Getting feedback about the translations from a wide crowd of people and users. This feedback can be in terms of votes for the best translation (when there are more than one translations for the same string), or it can be a new alternative translation (for an existing translation), or it can be a new translation suggestion (for a string that is not translated yet).</li>
<li>Helping to ensure consistency among the translations.</li>
<li>Merging translations from different sources (for example translations made on Launchpad and those made on KDE or GNOME).</li>
</ul>
</div>
</div>
<div class="outline-3" id="outline-container-2.2">
<h3 id="sec-2.2" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">2.2</span> Are there any existing alternatives to B-Translator?</h3>
<div class="outline-text-3" id="text-2.2">
<div style="margin-bottom: 10px;">
To my knowledge, there are no such existing tools. People frequently ask how B-Translator is different from Pootle. Pootle, as far as I know, is just an online PO file editor; it doesn't have any features for collecting feedback from a crowd of people that are not translators.</div>
</div>
</div>
<div class="outline-3" id="outline-container-2.3">
<h3 id="sec-2.3" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">2.3</span> The meaning of B-Translator</h3>
<div class="outline-text-3" id="text-2.3">
<div style="margin-bottom: 10px;">
The name of the software is not the most important thing, however it should be somehow related to the basic idea of the software and to its goals, and it should be different from any other software. And of course it is better to be a nice name, rather than an ugly one.</div>
<div style="margin-bottom: 10px;">
The codename <b>B-Translator</b> can be decoded like <b>Bee Translator</b>, since it aims at collecting very small translation contributions from a wide crowd of people and to dilute them into something useful.</div>
<div style="margin-bottom: 10px;">
It can also be decoded like <b>Be Translator</b>, as an invitation to anybody to give his small contribution for translating programs or making their translations better.</div>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-3" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-3" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">3</span> Description of its features and functionality</h2>
<div class="outline-text-2" id="text-3">
<div style="margin-bottom: 10px;">
After having a clear idea of the overall aim and goals of the software, the software engineer should go into details about the features that the software should have and how it should work, so that it can properly achieve its goals. This is mainly a description of what the software should do and how it should do it, preferably in a simple language that even non-technical people (non-developers) can understand.</div>
<div style="margin-bottom: 10px;">
Maybe we cannot get everything 100% correct right from the beginning, however this approach is much better than starting to code right away, having just some vague ideas of what we are trying to build. Of course, we will take the chance later to correct and improve the feature requirements, as things become more clear.</div>
</div>
<div class="outline-3" id="outline-container-3.1">
<h3 id="sec-3.1" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">3.1</span> The features of B-Translator</h3>
<div class="outline-text-3" id="text-3.1">
<div style="margin-bottom: 10px;">
Here is a description of the main desired features of B-Translator.</div>
</div>
<div class="outline-4" id="outline-container-3.1.1">
<h4 id="sec-3.1.1" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.1</span> Open access</h4>
<div class="outline-text-4" id="text-3.1.1">
<div style="margin-bottom: 10px;">
Everybody should be able to use the system for the purpose of getting translation suggestions for a certain string, even unauthenticated (anonymous/guest) users. Furthermore, it should be possible to use an API (web services), so that these suggestions can be retrieved and used even by external applications.</div>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.2">
<h4 id="sec-3.1.2" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.2</span> Authenticated voting</h4>
<div class="outline-text-4" id="text-3.1.2">
<div style="margin-bottom: 10px;">
Submitting votes or new suggestions will be allowed only for the subscribed users (which have agreed to help and contribute). No contributions from anonymous/guests will be accepted.</div>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.3">
<h4 id="sec-3.1.3" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.3</span> Tracking votes</h4>
<div class="outline-text-4" id="text-3.1.3">
<div style="margin-bottom: 10px;">
Votes and suggestions will not be anonymous. For each vote or suggestion, the user who submitted it will be recorded and saved. This will allow the user to see all the strings that he has already voted for, and also to change any of the votes, if he later changed his mind. At the same time it will prevent multiple votes by the same user for the same translation.</div>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.4">
<h4 id="sec-3.1.4" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.4</span> Highly customizable</h4>
<div class="outline-text-4" id="text-3.1.4">
<div style="margin-bottom: 10px;">
The system should have a flexible configuration and customization page. This means that the user should be able to customize how much he would like to help and contribute. For example:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>how many translation votes per day (an upper limit)</li>
<li>which communication means he prefers (email, facebook, google+, twitter, website, android app, iPhone app, etc.)</li>
<li>which projects or packages he would like to focus on (for example, if the user selects the package KDE, only strings that belong to a project on this package will be sent to him for review and feedback)</li>
<li>which languages he would like to use as primary and secondary source languages (for example a user that is not confident in English, may choose to use French as a primary language and Italian+Spanish as secondary/helper languages)</li>
<li>sequential or random selection of strings (random is the default, but if the user is interested in just one or a few projects, he may prefer to review the strings sequentially)</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.5">
<h4 id="sec-3.1.5" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.5</span> Evaluation algorithms</h4>
<div class="outline-text-4" id="text-3.1.5">
<div style="margin-bottom: 10px;">
The contribution and performance of the users should be measured and evaluated using certain algorithms and/or heuristics. The users will be awarded points based on their performance. Probably some rewarding mechanisms can be integrated later for the top contributors.</div>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.6">
<h4 id="sec-3.1.6" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.6</span> Detailed and comprehensive reporting and statistics</h4>
<div class="outline-text-4" id="text-3.1.6">
<div style="margin-bottom: 10px;">
Different kinds of reports and statistics related to users, projects, activity etc. should be supported and provided.</div>
</div>
</div>
<div class="outline-4" id="outline-container-3.1.7">
<h4 id="sec-3.1.7" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">3.1.7</span> Integration with the existing workflow of the project translations</h4>
<div class="outline-text-4" id="text-3.1.7">
<div style="margin-bottom: 10px;">
Project translators will continue to work with their preferred tools (like Pootle, Lokalize, etc.). They will also continue to use their preferred workflows (the way that they coordinate their translation work with each-other and with the project releases).</div>
<div style="margin-bottom: 10px;">
This system should help them to get feedback and possibly any new suggestions or translations from a big crowd of the contributors. The system should provide means and tools for easy integration with the workflow of the project translations.</div>
<div style="margin-bottom: 10px;">
For example, it should allow the translation maintainers to import their existing translation files (PO files), and to export translation files that contain the most voted translations, as well as new suggestions (for translated strings) or new translations (for untranslated strings). It should also allow them to get the latest changes (suggestions, translations, etc.) since the last time that they checked, or since a predefined moment in the past.</div>
<div style="margin-bottom: 10px;">
The latest changes should be exported in a format that is easy to review, modify and apply (diff or ediff).</div>
</div>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-4" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-4" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">4</span> Analyzing the functionality in more details</h2>
<div class="outline-text-2" id="text-4">
<div style="margin-bottom: 10px;">
In the previous sections we discussed defining the aim and scope of the software (conception) and describing the desired features and functionality in general terms. Both of these steps belong to the phase called <b>defining requirements of the software</b>. The next step (or phase) is to analyze in more details how the software is supposed to work, and it is called <b>analysis</b> (or <b>functional analysis</b>).</div>
<div style="margin-bottom: 10px;">
Functional analysis is usually performed by identifying the <b>actors</b> (users or other programs/components that are interacting with our software/system), by identifying <b>use cases</b> (all the different cases when the actors need to interact with our software/system), and describing each <b>use case</b> (the details of how each interaction is done).</div>
<div style="margin-bottom: 10px;">
In order to be clear and concise in describing such things, diagrams are often useful. The standard for drawing diagrams in software engineering domain is UML (Unified Modeling Language).</div>
</div>
<div class="outline-3" id="outline-container-4.1">
<h3 id="sec-4.1" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">4.1</span> The actors and use-cases of B-Translator</h3>
<div class="outline-text-3" id="text-4.1">
<div style="margin-bottom: 10px;">
The actors and use-cases that can be identified for B-Translator are these:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li><b>guest</b> (anonymous user)<ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><b>get</b> translation suggestions for a string</li>
<li><b>search</b> strings and translations</li>
<li><b>export</b> translations</li>
<li><b>comment</b> on translations</li>
</ul>
</li>
<li><b>contributor</b> (authenticated user)<ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>all the use-cases of guest</li>
<li>customize his own <b>preferences</b> and settings</li>
<li><b>vote</b> (or <b>like</b>) translations</li>
<li><b>suggest</b> new translations</li>
<li><b>flag</b> inappropriate comments or translations</li>
<li>check his own contribution details in a <b>dashboard</b>, and how it compares with the others</li>
</ul>
</li>
<li><b>translator</b><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>all the use-cases of contributor</li>
<li><b>import</b> translation files</li>
<li><b>export</b> translations and suggestions</li>
</ul>
</li>
<li><b>moderator</b><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>all the use-cases of contributor</li>
<li>access <b>statistics</b> and other details</li>
<li><b>resolve</b> flagged comments and translations</li>
</ul>
</li>
<li><b>administrator</b><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>manage overall software <b>configuration</b></li>
<li>manage user access rights and <b>permissions</b></li>
</ul>
</li>
<li><b>script</b><ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li><b>update</b> translation data with the latest versions</li>
<li><b>notify</b> users about relevant issues</li>
<li>apply suggested translations <b>upstream</b>, wherever possible and suitable</li>
</ul>
</li>
<li><b>peer</b> B-Translator installation<ul style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>request <b>sync</b> data (in case there are several B-Translation installations, they should be able to synchronize the data with each-other, if needed)</li>
</ul>
</li>
</ul>
<div style="margin-bottom: 10px;">
These actors and use-cases are also presented in the following diagram (which is drawn using <a href="http://www.umlet.com/" style="color: #0088cc; text-decoration: none;">Umlet</a>):</div>
<div class="figure" id="fig:functional_analysis" style="padding: 0.5em;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Vfmy6vHgPYE/UDyZw75c4dI/AAAAAAAAAuU/0ssQuDlKMMk/s1600/functional_analysis.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-Vfmy6vHgPYE/UDyZw75c4dI/AAAAAAAAAuU/0ssQuDlKMMk/s1600/functional_analysis.png" /></a></div>
<div style="margin-bottom: 10px; text-align: center;">
</div>
<div style="margin-bottom: 10px; text-align: center;">
Actors and Use-cases of B-Translator.</div>
</div>
<div style="margin-bottom: 10px;">
There are also the cases when the software is accessed through a third party application (for example a Facebook, LinkedIn, Google+, Android, iPhone, or desktop application), through a web-service API, however these use-cases can be reduced to either the <b>guest</b> or <b>contributor</b> cases.</div>
<div style="margin-bottom: 10px;">
I am not going to describe the details of each use-case because it would take lots of space. Anyway, most of them are almost obvious.</div>
</div>
</div>
<div class="outline-3" id="outline-container-4.2">
<h3 id="sec-4.2" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">4.2</span> Interfaces</h3>
<div class="outline-text-3" id="text-4.2">
</div>
<div class="outline-4" id="outline-container-4.2.1">
<h4 id="sec-4.2.1" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">4.2.1</span> Suggestion interface</h4>
<div class="outline-text-4" id="text-4.2.1">
<div style="margin-bottom: 10px;">
This is the form where the (authenticated) user is presented with an English string and several translation suggestions for it, and he votes the one that he thinks is the best, or provides another suggestion which he thinks is better.</div>
<div style="margin-bottom: 10px;">
The string to be translated is selected randomly, unless the user has selected 'sequential' on his settings. The selection of the string is also done so that it complies with the restrictions imposed by the user on his settings (for example only from a certain project).</div>
<div style="margin-bottom: 10px;">
The selection of the string should be also influenced by certain algorithms and heuristics, which should try to give more exposure to the strings that need more votes. For example if a string already got 10 votes and another one got just 2 votes, the second one should be more likely to be selected.</div>
<div style="margin-bottom: 10px;">
This interface should be able to integrate somehow with facebook, email, google+, etc.</div>
</div>
</div>
<div class="outline-4" id="outline-container-4.2.2">
<h4 id="sec-4.2.2" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">4.2.2</span> Query interface</h4>
<div class="outline-text-4" id="text-4.2.2">
<div style="margin-bottom: 10px;">
On this form anybody (registered user or anonymous) can supply a string in English, and the system will return the translation suggestions related to it and the corresponding votes that each suggestion has.</div>
<div style="margin-bottom: 10px;">
If the English string does not have an exact match on the DB, a list of similar strings will be returned and the user will choose to check one of them.</div>
<div style="margin-bottom: 10px;">
This functionality of querying suggestions will be offered also by a web service so that it can be used by any external programs.</div>
</div>
</div>
<div class="outline-4" id="outline-container-4.2.3">
<h4 id="sec-4.2.3" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">4.2.3</span> User configuration interface</h4>
<div class="outline-text-4" id="text-4.2.3">
<div style="margin-bottom: 10px;">
Here the user customizes his settings, as described in the functional requirements. Some of the things that he can customize are:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>how many translation reviews per day (default one)</li>
<li>which communication means he prefers (email, facebook, google+, twitter, website, android app, iPhone app, etc.)</li>
<li>which projects or packages he would like to focus on (for example, if the user selects the package KDE, only strings that belong to a project on this package will be sent to him for review and feedback)</li>
<li>which languages he would like to use as primary and secondary source languages (for example a user that is not confident in English, may choose to use French as a primary language and Italian+Spanish as secondary/helper languages)</li>
<li>sequential or random selection of strings (random is the default, but if the user is interested in just one or a few projects, he may prefer to review the strings sequentially)</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-4.2.4">
<h4 id="sec-4.2.4" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">4.2.4</span> Export and import interfaces</h4>
<div class="outline-text-4" id="text-4.2.4">
<div style="margin-bottom: 10px;">
Usually everybody can export PO files, but only the users with certain permissions can import.</div>
</div>
</div>
<div class="outline-4" id="outline-container-4.2.5">
<h4 id="sec-4.2.5" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">4.2.5</span> Admin interfaces</h4>
<div class="outline-text-4" id="text-4.2.5">
<div style="margin-bottom: 10px;">
The admin should be able to customize the overall behavior of the module, to check activity, to get reports and statistics, to maintain the data (backup, restore, update) etc.</div>
</div>
</div>
</div>
</div>
<div class="outline-2" id="outline-container-5" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-5" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">5</span> Designing the software</h2>
<div class="outline-text-2" id="text-5">
<div style="margin-bottom: 10px;">
Design is a description in logical (abstract) terms of the parts and components that will make up the software, how they are composed, how they interact with each-other, etc. The UML diagrams can be useful again for describing concisely and clearly the entities, their relationships and interactions. It is the last layer of abstract description, before the implementation (coding) of the software starts. However frequently there is not a clear distinction line between analysis and design, and between design and implementation.</div>
<div style="margin-bottom: 10px;">
The design usually describes the database entities and relationships, the interfaces of the application, APIs (Application Programing Interfaces), classes and objects and their relationships, the most important processes and algorithms, etc. A good design should try to capture only the most important things, leaving out the obvious or unimportant things.</div>
</div>
<div class="outline-3" id="outline-container-5.1">
<h3 id="sec-5.1" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">5.1</span> The DB schema of B-Translator</h3>
<div class="outline-text-3" id="text-5.1">
<div style="margin-bottom: 10px;">
The DB tables and their fields:</div>
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">Files</dt>
<dd style="margin-left: 10px;">A PO file that is imported and can be exported from the DB.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">fid : serial</dt>
<dd style="margin-left: 10px;">Auto-increment internal identifier.</dd>
<dt style="font-weight: bold;">filename : varchar(250)</dt>
<dd style="margin-left: 10px;">The path and filename of the imported PO file.</dd>
<dt style="font-weight: bold;">hash : char(40)</dt>
<dd style="margin-left: 10px;">The SHA1() hash of the whole file content.</dd>
<dt style="font-weight: bold;">potid : int</dt>
<dd style="margin-left: 10px;">Reference to the template (POT) for which this PO file is a translation.</dd>
<dt style="font-weight: bold;">lng : varchar(10)</dt>
<dd style="margin-left: 10px;">The code of the translation language.</dd>
<dt style="font-weight: bold;">headers : text</dt>
<dd style="margin-left: 10px;">Headers of the imported PO file, as a long line. Needed mainly for exporting.</dd>
<dt style="font-weight: bold;">comments : text</dt>
<dd style="margin-left: 10px;">Translator comments of the file (above the header entry). Needed mainly for exporting.</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">Id of the user that imported the file.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The date and time that the record was registered.</dd></dl>
</dd>
<dt style="font-weight: bold;">Templates</dt>
<dd style="margin-left: 10px;">POT files that are imported.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">potid : serial</dt>
<dd style="margin-left: 10px;">Auto-increment internal identifier.</dd>
<dt style="font-weight: bold;">tplname : varchar(50)</dt>
<dd style="margin-left: 10px;">The name of the POT template (to distinguish it from the other templates of the same project).</dd>
<dt style="font-weight: bold;">filename : varchar(250)</dt>
<dd style="margin-left: 10px;">The path and name of the imported POT file.</dd>
<dt style="font-weight: bold;">pguid : char(40)</dt>
<dd style="margin-left: 10px;">Reference to the project to which this PO template belongs. it come from).</dd>
<dt style="font-weight: bold;">uid : int(11)</dt>
<dd style="margin-left: 10px;">Id of the user that registered the project.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The date and time that the template was imported.</dd></dl>
</dd>
<dt style="font-weight: bold;">Projects</dt>
<dd style="margin-left: 10px;">A project is the software/application which is translated by the PO files.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">pguid : char(40)</dt>
<dd style="margin-left: 10px;">Project Globally Unique ID, pguid = SHA1(CONCAT(origin,project))</dd>
<dt style="font-weight: bold;">project : varchar(100)</dt>
<dd style="margin-left: 10px;">Project name (with the release appended if needed).</dd>
<dt style="font-weight: bold;">origin : varchar(100)</dt>
<dd style="margin-left: 10px;">The origin of the project (where does it come from).</dd>
<dt style="font-weight: bold;">uid : int(11)</dt>
<dd style="margin-left: 10px;">Id of the user that registered the project.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The date and time that the project was registered.</dd></dl>
</dd>
<dt style="font-weight: bold;">Locations</dt>
<dd style="margin-left: 10px;">Locations (lines) where a l10n string is found.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">lid : serial</dt>
<dd style="margin-left: 10px;">Internal numeric identifier of a line.</dd>
<dt style="font-weight: bold;">sguid : char(40)</dt>
<dd style="margin-left: 10px;">Reference to the id of the l10n string contained in this line.</dd>
<dt style="font-weight: bold;">potid : int</dt>
<dd style="margin-left: 10px;">Reference to the id of the template (POT) that contains this line.</dd>
<dt style="font-weight: bold;">translator_comments : varchar(500)</dt>
<dd style="margin-left: 10px;">Translator comments in the PO entry (starting with "# ").</dd>
<dt style="font-weight: bold;">extracted_comments : varchar(500)</dt>
<dd style="margin-left: 10px;">Extracted comments in the PO entry (starting with "#. ").</dd>
<dt style="font-weight: bold;">line_references : varchar(500)</dt>
<dd style="margin-left: 10px;">Line numbers where the sting occurs (starting with "#: ").</dd>
<dt style="font-weight: bold;">flags : varchar(100)</dt>
<dd style="margin-left: 10px;">Flags of the PO entry (starting with "#, ").</dd>
<dt style="font-weight: bold;">previous_msgctxt : varchar(500)</dt>
<dd style="margin-left: 10px;">Previous msgctxt in the PO entry (starting with "#| msgctxt ").</dd>
<dt style="font-weight: bold;">previous_msgid : varchar(500)</dt>
<dd style="margin-left: 10px;">Previous msgid in the PO entry (starting with "#| msgid ").</dd>
<dt style="font-weight: bold;">previous_msgid_plural : varchar(500)</dt>
<dd style="margin-left: 10px;">Previous msgid_plural in the PO entry (starting with "#| msgid_plural ").</dd></dl>
</dd>
<dt style="font-weight: bold;">Strings</dt>
<dd style="margin-left: 10px;">Translatable strings that are extracted from projects.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">string : text</dt>
<dd style="margin-left: 10px;">The string to be translated: CONCAT(msgid,CHAR(0),msgid_plural)</dd>
<dt style="font-weight: bold;">context : varchar(500)</dt>
<dd style="margin-left: 10px;">The string context (msgctxt of the PO entry).</dd>
<dt style="font-weight: bold;">sguid : char(40)</dt>
<dd style="margin-left: 10px;">Globally Unique ID of the string, as hash of the string and context: SHA1(CONCAT(string,context))</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">ID of the user that inserted this string on the DB.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The time that this string was entered on the DB.</dd>
<dt style="font-weight: bold;">count : int/tiny</dt>
<dd style="margin-left: 10px;">How often this string is encountered in all the projects. Can be useful for any heuristics that try to find out which strings should be translated first.</dd>
<dt style="font-weight: bold;">active : boolean</dt>
<dd style="margin-left: 10px;">The active/deleted status of the record.</dd></dl>
</dd>
<dt style="font-weight: bold;">Translations</dt>
<dd style="margin-left: 10px;">Translations/suggestions of the l10n strings. For each string there can be translations for different languages, and more than one translation for each language.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">sguid : int</dt>
<dd style="margin-left: 10px;">Reference to the id of the l10n string that is translated.</dd>
<dt style="font-weight: bold;">lng : varchar(5)</dt>
<dd style="margin-left: 10px;">Language code (en, fr, sq_AL, etc.)</dd>
<dt style="font-weight: bold;">translation : varchar(1000)</dt>
<dd style="margin-left: 10px;">The (suggested) translation of the string.</dd>
<dt style="font-weight: bold;">tguid : char(40)</dt>
<dd style="margin-left: 10px;">Globally Unique ID of the translation, defined as the hash: SHA1(CONCAT(translation,lng,sguid))</dd>
<dt style="font-weight: bold;">count : int/tiny</dt>
<dd style="margin-left: 10px;">Count of votes received so far. This can be counted on the table Votes, but for convenience is stored here as well.</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">id of the user that initially suggested/submitted this translation</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">Time that the translation was entered into the database.</dd>
<dt style="font-weight: bold;">active : boolean</dt>
<dd style="margin-left: 10px;">The active or deleted status of the record.</dd></dl>
</dd>
<dt style="font-weight: bold;">Votes</dt>
<dd style="margin-left: 10px;">Votes for each translation/suggestion.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">vid : serial</dt>
<dd style="margin-left: 10px;">Internal numeric identifier for a vote.</dd>
<dt style="font-weight: bold;">tguid : char(40)</dt>
<dd style="margin-left: 10px;">Reference to the id of the translation which is voted.</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">Reference to the id of the user that submitted the vote.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">Timestamp of the voting time.</dd>
<dt style="font-weight: bold;">active : boolean</dt>
<dd style="margin-left: 10px;">The active or deleted status of the record.</dd></dl>
</dd>
<dt style="font-weight: bold;">Users</dt>
<dd style="margin-left: 10px;">Users that contribute translations/suggestions/votes.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">The numeric identifier of the user.</dd>
<dt style="font-weight: bold;">points : int</dt>
<dd style="margin-left: 10px;">Number of points rewarded for his activity.</dd>
<dt style="font-weight: bold;">config : varchar(250)</dt>
<dd style="margin-left: 10px;">Serialized configuration variables.</dd></dl>
</dd>
<dt style="font-weight: bold;">Snapshots</dt>
<dd style="margin-left: 10px;">Snapshots are tgz archives of project-lng translation files.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">pguid : char(40)</dt>
<dd style="margin-left: 10px;">Reference to the project.</dd>
<dt style="font-weight: bold;">lng : varchar(10)</dt>
<dd style="margin-left: 10px;">The language of translation.</dd>
<dt style="font-weight: bold;">snapshot : mediumblob</dt>
<dd style="margin-left: 10px;">The content of the tgz archive.</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">Id of the user that updated the snapshot for the last time.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The time of last update.</dd></dl>
</dd>
<dt style="font-weight: bold;">Diffs</dt>
<dd style="margin-left: 10px;">Diffs between the current state and the last snapshot.
<br />
<dl style="margin-bottom: 20px;">
<dt style="font-weight: bold;">pguid : char(40)</dt>
<dd style="margin-left: 10px;">Reference to the project.</dd>
<dt style="font-weight: bold;">lng : varchar(10)</dt>
<dd style="margin-left: 10px;">The language of translation.</dd>
<dt style="font-weight: bold;">nr : smallint</dt>
<dd style="margin-left: 10px;">Incremental number of the diffs of a project-language.</dd>
<dt style="font-weight: bold;">diff : text</dt>
<dd style="margin-left: 10px;">The content of the unified diff (diff -u).</dd>
<dt style="font-weight: bold;">ediff : text</dt>
<dd style="margin-left: 10px;">The embedded diff (generated with the command poediff of pology).</dd>
<dt style="font-weight: bold;">comment : varchar(200)</dt>
<dd style="margin-left: 10px;">Comment/description of the diff.</dd>
<dt style="font-weight: bold;">uid : int</dt>
<dd style="margin-left: 10px;">Id of the user that inserted the diff.</dd>
<dt style="font-weight: bold;">time : datetime</dt>
<dd style="margin-left: 10px;">The date and time that the diff was saved.</dd></dl>
</dd></dl>
<div style="margin-bottom: 10px;">
Files, Templates, Locations and Projects are related to the import/export of the PO files. Snapshots and Diffs are used to export/extract the suggestions . Projects and Categories can be used to limit the scope of the search (and other operations).</div>
<div style="margin-bottom: 10px;">
A project contains the translations of a certain application (software). A project can have several template (POT) files. A template file can have several PO files (one for each different language). Each of these PO files has many PO entries, which are stored in the table Locations.</div>
<div style="margin-bottom: 10px;">
The table Locations stores only the comments, line references, flags, previous strings, etc. of each PO entry.</div>
<div style="margin-bottom: 10px;">
The msgid (and msgctxt) of the entry is stored on the table Strings. A string can be connected to several locations, since the same string can be used on different projects.</div>
<div style="margin-bottom: 10px;">
Each string can have several translations (or suggestions) in each language. Each translation can have many votes. Each vote is given by a certain user.</div>
<div class="figure" id="fig:db_diagram" style="padding: 0.5em;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-cgNsaDLQszo/UDyaxyQCbvI/AAAAAAAAAuc/UsW78Fs005s/s1600/db_diagram.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-cgNsaDLQszo/UDyaxyQCbvI/AAAAAAAAAuc/UsW78Fs005s/s1600/db_diagram.png" /></a></div>
<div style="margin-bottom: 10px; text-align: center;">
</div>
<div style="margin-bottom: 10px; text-align: center;">
Tables and their relations.</div>
</div>
<div class="figure" id="fig:object_diagram_1" style="padding: 0.5em;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-ITmE2zUv09U/UDya14TaIzI/AAAAAAAAAuk/dZDLOfTK6T0/s1600/object_diagram_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-ITmE2zUv09U/UDya14TaIzI/AAAAAAAAAuk/dZDLOfTK6T0/s1600/object_diagram_1.png" /></a></div>
<div style="margin-bottom: 10px; text-align: center;">
</div>
<div style="margin-bottom: 10px; text-align: center;">
Structure of the DB.</div>
</div>
<div class="figure" id="fig:object_diagram_2" style="padding: 0.5em;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-x_lf4VX4SWM/UDya2uN6stI/AAAAAAAAAuo/a4-mjQLelTY/s1600/object_diagram_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-x_lf4VX4SWM/UDya2uN6stI/AAAAAAAAAuo/a4-mjQLelTY/s1600/object_diagram_2.png" /></a></div>
<div style="margin-bottom: 10px; text-align: center;">
</div>
<div style="margin-bottom: 10px; text-align: center;">
Structure of the DB.</div>
</div>
<div class="figure" id="fig:object_diagram_3" style="padding: 0.5em;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-M8hpQE_1GRI/UDya3UJpfpI/AAAAAAAAAuw/VhEnirrpV7M/s1600/object_diagram_3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-M8hpQE_1GRI/UDya3UJpfpI/AAAAAAAAAuw/VhEnirrpV7M/s1600/object_diagram_3.png" /></a></div>
<div style="margin-bottom: 10px; text-align: center;">
</div>
<div style="margin-bottom: 10px; text-align: center;">
Structure of the DB.</div>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-5.2">
<h3 id="sec-5.2" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">5.2</span> API</h3>
<div class="outline-text-3" id="text-5.2">
</div>
</div>
</div>
<div class="outline-2" id="outline-container-6" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-6" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">6</span> Construction (implementation/development)</h2>
<div class="outline-text-2" id="text-6">
<div style="margin-bottom: 10px;">
Implementation is the process of actually building the software. Before the implementation starts, several decisions have to be done, like:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>what platform to use</li>
<li>what programing language or framework should be used</li>
<li>what database should be used</li>
<li>what tools to use for development</li>
<li>how to coordinate the work of several developers</li>
<li>programing standards to be used</li>
<li>etc.</li>
</ul>
<div style="margin-bottom: 10px;">
For B-Translator it was obvious that it was going to be a web application, running on a LAMP platform (Linux+Apache+MySQL+PHP). Moreover, I decided to implement it as a Drupal module, in order to take advantage of the other existing Drupal modules. Drupal is a powerful framework for building web application, it has a powerful API, and there are lots of available modules that implement various features. This way I could focus on building only the functionality that is specific for my problem, and use the available modules for building a fully functional web application. Furthermore, I decided to use Drupal7, since that was the latest version of Drupal when I started, although the support of the additional modules was not so good at that time.</div>
<div style="margin-bottom: 10px;">
For programing and development I use the Emacs editor, which is quite powerful. Also this is the editor that I am most familiar with, and I always use it for my programing tasks.</div>
<div style="margin-bottom: 10px;">
As a version control system I use git. Actually the repository of the project is hosted on github.com (<a href="https://github.com/dashohoxha/B-Translator" style="color: #0088cc; text-decoration: none;">https://github.com/dashohoxha/B-Translator</a>). Usage of a version control system is a must for every software development project, because:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>It keeps all the history of changes in the project and allows you to roll back to a previous state, in case that something goes wrong.</li>
<li>It allows you to have tags and branches, which help the management of the development process.</li>
<li>It allows several developers to easily coordinate and merge their work with each other.</li>
<li>It simplifies the task of providing patches for external contributors.</li>
</ul>
<div style="margin-bottom: 10px;">
The coding style and standards of B-Translator are those used by Drupal. For unit testing and functional testing the module 'simpletest' of Drupal is used. It works by defining several test cases, and then making sure that the module passes successfully all of them.</div>
<div style="margin-bottom: 10px;">
For communication/discussions among the developers there is an IRC chatroom named <b>#btranslator</b> on <b>irc.freenode.net</b>. There is also the group/forum/mailing-list <a href="https://groups.google.com/forum/?hl=en&fromgroups#!categories/btranslator" style="color: #0088cc; text-decoration: none;">B-Translator</a> on Google, for notifications, discussions, etc. There is as well the channel <b>@btranslator</b> on Twitter, mostly for notifications.</div>
<div style="margin-bottom: 10px;">
Actually, right now I am the only developer of the project, however I do hope that in the future there will be other developers and contributors as well. If you are interested to help, please contact me (at dashohoxha@gmail.com) or join the forum above.</div>
</div>
</div>
<div class="outline-2" id="outline-container-7" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-7" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">7</span> Managing the project</h2>
<div class="outline-text-2" id="text-7">
<div style="margin-bottom: 10px;">
Software engineering is not just about programing or development, but it is also about project management. Project management includes making a plan about how we are going to build the software, defining the things or tasks that need to be done, breaking down the tasks into smaller ones, assigning importance or priorities to the tasks, deciding which ones should be done earlier and which ones can be done later, defining milestones and grouping tasks to them (according to the time that they should be completed), assigning tasks to people, etc.</div>
<div style="margin-bottom: 10px;">
The majority of tasks usually are related to programing and implementation, however anything else can be a task (for example, collecting requirements, performing the functional analysis, etc.).</div>
<div style="margin-bottom: 10px;">
There are some steps or phases that are common for all software engineering projects, like:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>collecting/updating the requirements</li>
<li>defining/refining features and functionality</li>
<li>analyzing/understanding/describing the details of each feature</li>
<li>making/correcting design decisions</li>
<li>implementing or improving features</li>
<li>testing, debugging and making sure that they work correctly</li>
<li>etc.</li>
</ul>
<div style="margin-bottom: 10px;">
How these phases are combined together depends on the software that is to be build. If you have enough experience with building such kind of software, and you have a clear idea from the beginning about what is to be built, then a waterfall approach might be OK.</div>
<div style="margin-bottom: 10px;">
However, in most cases things are not very clear right from the beginning, and they become more clear as you work on the project, do some implementation and testing, get feedback from the users, etc. This is especially true if the software that you are trying to build is kind of innovative, something that nobody else has tried to build before. In this case an 'iterative and incremental' model could be more suitable. In this model you build and release an initial product (or prototype), and with the experience collected during the process and any feedback from the users, start again from the beginning and refine the requirements, analysis etc. and build another release of the software. These cycles can be repeated as many times as necessary, and in each cycle incremental changes/improvements are made to the software.</div>
<div style="margin-bottom: 10px;">
B-Translator has followed an iterative and incremental life cycle. Although from the previous sections it may appear that things happened in a clean waterfall model, the truth is that the current requirements, functional analysis, design, etc. are the result of several iterations (cycles). For example:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>The design of the database became more clear only after starting to implement it. Actually I had to change the structure of the database several times, until it was suitable.</li>
<li>Initially I depended on importing the data collected by <a href="http://open-tran.eu/" style="color: #0088cc; text-decoration: none;">open-tran.eu</a>. However, I decided later to implement my own scripts for getting translation files and importing them on the DB.</li>
<li>Integration with the existing workflow of the project translations was something that occurred to me later, after I had started implementation.</li>
<li>Integration required the ability to import and export PO files, and this made me add some extra tables for keeping the relevant information.</li>
<li>Initially I did not think about the possibility of exporting diff (and ediff) files. After deciding to implement such a feature, I had to add a few more tables in the design of the database.</li>
<li>The possibility for appending comments to each translation was suggested to me by one of the translators.</li>
</ul>
<div style="margin-bottom: 10px;">
The tool that I use for keeping the project organized is the <a href="http://orgmode.org/" style="color: #0088cc; text-decoration: none;">mode-org of Emacs</a>. It is a wonderful tool, simple and flexible, but has also advanced features if you need them. It can be used for keeping notes, for task management, and also for documentation writing (all the documents related to B-Translator, including this one, are composed with it). Its wiki-like syntax, combined with the power of Emacs, make it very practical.</div>
<div style="margin-bottom: 10px;">
Right now, for bug reporting, feature requests, etc. the issues section on GitHub can be used: <a href="https://github.com/dashohoxha/B-Translator/issues" style="color: #0088cc; text-decoration: none;">https://github.com/dashohoxha/B-Translator/issues</a> . Later maybe I can install <a href="http://trac.edgewall.org/" style="color: #0088cc; text-decoration: none;">trac</a>, which is nice tool for software project management.</div>
</div>
</div>
<div class="outline-2" id="outline-container-8" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<h2 id="sec-8" style="color: inherit; font-family: inherit; font-size: 30px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-2">8</span> Documentation</h2>
<div class="outline-text-2" id="text-8">
<div style="margin-bottom: 10px;">
Documentation describes how to install the software, how it works, how it should be used, etc.</div>
</div>
<div class="outline-3" id="outline-container-8.1">
<h3 id="sec-8.1" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">8.1</span> Installation of B-Translator</h3>
<div class="outline-text-3" id="text-8.1">
<div style="margin-bottom: 10px;">
A full distro including Drupal core (with patches) and the <i>btranslation</i> installation profile can be built like this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">cd /var/www/
sudo git clone https://github.com/dashohoxha/B-Translator.git
sudo B-Translator/install/all.sh
</pre>
<div style="margin-bottom: 10px;">
For more detailed information about installation see: <a href="https://github.com/dashohoxha/B-Translator/blob/master/docs/INSTALL.org" style="color: #0088cc; text-decoration: none;">https://github.com/dashohoxha/B-Translator/blob/master/docs/INSTALL.org</a></div>
</div>
</div>
<div class="outline-3" id="outline-container-8.2">
<h3 id="sec-8.2" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">8.2</span> How B-Translator works</h3>
<div class="outline-text-3" id="text-8.2">
</div>
<div class="outline-4" id="outline-container-8.2.1">
<h4 id="sec-8.2.1" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.1</span> Build a dictionary of l10n strings</h4>
<div class="outline-text-4" id="text-8.2.1">
<div style="margin-bottom: 10px;">
The source of the translation data used by the software are the POT/PO files of the projects. The PO template files (POT) contain the list of translatable strings of a project (in English), and the PO translation files contain the strings and the corresponding translations for a certain language. (More information and details about PO/POT formats and the translation process is provided by `info gettext`.)</div>
<div style="margin-bottom: 10px;">
These PO files are imported into the DB of the software. This import creates a dictionary of strings and their corresponding translations. The same string can be used in more than one projects, but in the dictionary it is stored only once. However, if the same string has different translations in several projects, all of the distinct translations will be stored into the DB.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.2.2">
<h4 id="sec-8.2.2" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.2</span> Collect feedback from users/reviewers</h4>
<div class="outline-text-4" id="text-8.2.2">
<div style="margin-bottom: 10px;">
These strings and the corresponding translations are presented for review to a large community of reviewers/users. The reviewers indicate which translation they think is the best by voting for it. They can also suggest any new translations (or suggest translations for strings that are yet un-translated). These new translations and the votes/likes of the reviewers are stored in the DB as well</div>
<div style="margin-bottom: 10px;">
The review process happens slowly and gradually during a long time. We can assume that each reviewer checks only one string each day, and that there is a very large number of reviewers that give feedback each day. The feedback can be collected through different channels, like web interface, social networks (Facebook, Google+, Twitter), email, mobile apps, etc.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.2.3">
<h4 id="sec-8.2.3" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.3</span> Export the revised translations</h4>
<div class="outline-text-4" id="text-8.2.3">
<div style="margin-bottom: 10px;">
Besides the dictionary of strings and translations, the import of PO files saves also the structure of these files and all the relevant data that are needed to export them again from the DB. However, during the export of the PO files, the most voted translations for each string are retrieved from the DB, instead of the original translations that were imported. This is how the input/feedback of the reviewers is transferred into the PO files. These exported PO files can then be uploaded/committed into the repositories of the corresponding projects.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.2.4">
<h4 id="sec-8.2.4" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.4</span> The process/workflow for a project without translation</h4>
<div class="outline-text-4" id="text-8.2.4">
<div style="margin-bottom: 10px;">
According to the steps described above, the process/workflow for a project that has no translation yet, would be like this:</div>
<ol style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>Checkout POT files from the repository of the project.</li>
<li>Import them into the DB.</li>
<li>Over some time, collect translation suggestions from the users. These translations can also be reviewed and evaluated by other users.</li>
<li>Export the PO files from the DB.</li>
<li>Review, fix and reformat them as needed.</li>
<li>Upload/commit the PO files into the repository of the project.</li>
<li>When a new POT file is released, start over again from the beginning (but this time we also import the PO file, besides the POT file).</li>
</ol>
<div style="margin-bottom: 10px;">
This process works well if there are no traditional translators to the project, and there is no other translation workflow happening concurrently (in parallel) with this one. Otherwise there would be a need to integrate these two workflows so that they don't override each-other.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.2.5">
<h4 id="sec-8.2.5" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.5</span> Exporting only the latest suggestions (diffs)</h4>
<div class="outline-text-4" id="text-8.2.5">
<div style="margin-bottom: 10px;">
In practice actually there is an existing translation workflow for almost all the projects. This translation is done either by using a Pootle system or by using PO editors. So, it is important that our workflow integrates with this existing workflow.</div>
<div style="margin-bottom: 10px;">
This integration is helped by exporting diffs instead of exporting PO files. These diffs are retrieved by the maintainers of the existing translation workflow (translators), and they contain the latest translation suggestions made by the reviewers through the feedback system. Such diffs can then be easily checked by the translators, and if they find them appropriate they can apply them to the PO files on the existing workflow.</div>
<div style="margin-bottom: 10px;">
Diffs are made between the current state of translations and the last snapshot of the translations. This ensures that diffs do not contain any suggestions that have been included already in the previous diffs, and so making more easy the work of the translators. The translator is usually interested only on the last diff, however the previous diffs are saved in the DB as well, in order to have a full history of the suggested translations over the time. Whenever a translator checks the latest diff, he should also make a snapshot, so that the translations that have been already suggested to him are not suggested again. Making a snapshot will also generate the diff with the previous snapshot and store this diff on the DB as well.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.2.6">
<h4 id="sec-8.2.6" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.2.6</span> The process/workflow for an integrated translation</h4>
<div class="outline-text-4" id="text-8.2.6">
<div style="margin-bottom: 10px;">
The process/workflow for the case when the feedback provided by the system is integrated in the mainstream translation workflow is like this:</div>
<ol style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>Checkout the latest version of the POT and PO files from the repository of the project.</li>
<li>Import POT files and PO files into the DB.</li>
<li>Over some time, collect votes and new translation suggestions from the users.</li>
<li>Time after time (for example each month), the mainstream translator checks out the last diffs, containing the latest suggestions (and makes a snapshot as well).</li>
<li>The translator reviews the latest suggestions and applies them in the mainstream translation, if he finds them appropriate.</li>
<li>Periodically (for example once or twice a year) go back to steps (1) and (2) and import the POT and PO files again. This re-import may introduce new strings and translations, but will not affect the existing strings, translations and votes.</li>
</ol>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-8.3">
<h3 id="sec-8.3" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">8.3</span> Drupal interfaces (paths)</h3>
<div class="outline-text-3" id="text-8.3">
</div>
<div class="outline-4" id="outline-container-8.3.1">
<h4 id="sec-8.3.1" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.3.1</span> translations[/<lng>/<sguid>]</h4>
<div class="outline-text-4" id="text-8.3.1">
<div style="margin-bottom: 10px;">
This interface presents a string and its available translations to the user. The user will vote one of them as the best translation, or will provide a new translation that he thinks is better.</div>
<div style="margin-bottom: 10px;">
<sguid> is the hash of the string that is being translated. If not given, then a random string will be selected.</div>
<div style="margin-bottom: 10px;">
The original string is usually presented in English, but additional languages can be presented as well, if the user is not confident with English. (He can select these options on the user settings page as well.)</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.3.2">
<h4 id="sec-8.3.2" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.3.2</span> translations/search?lng=..&limit=..&mode=..&words=..</h4>
<div class="outline-text-4" id="text-8.3.2">
<div style="margin-bottom: 10px;">
Displays a list of strings and the corresponding suggestions, which match some filter conditions. Filter conditions can be modified on the interface. Search can be done by the content of the strings and suggestions, and can be limited in scope by the project, by the author of suggestions, by the submission date, etc.</div>
<div style="margin-bottom: 10px;">
From the displayed list, it is also possible to view details (for string or suggestion), to submit votes, etc.</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.3.3">
<h4 id="sec-8.3.3" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.3.3</span> translations/project</h4>
<div class="outline-text-4" id="text-8.3.3">
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>translations/project/list ([/origin[/project[/format]]])</li>
<li>translations/project/export (/origin/project/language)</li>
<li>translations/project/export_tgz (/origin/project/language)</li>
<li>translations/project/diff (/origin/project/lng[/nr[/ediff]]) Return the diff/ediff of the PO files for a given origin/project/lng/nr. If the parameter 'nr' is '-', it returns the latest most-voted suggestions since the last snapshot. If the parameter 'nr' is missing, it returns a list of the saved diffs instead.</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-8.3.4">
<h4 id="sec-8.3.4" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.3.4</span> translations/user_settings</h4>
<div class="outline-text-4" id="text-8.3.4">
<div style="margin-bottom: 10px;">
The user can set:</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>translation language</li>
<li>the preferred source language(s)</li>
<li>how many reviews per day is willing to make</li>
<li>etc.</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-8.3.5">
<h4 id="sec-8.3.5" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.3.5</span> translations/admin</h4>
<div class="outline-text-4" id="text-8.3.5">
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li>translations/admin/config</li>
<li>translations/admin/dashboard</li>
<li>translations/admin/reports</li>
<li>translations/admin/stats</li>
</ul>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-8.4">
<h3 id="sec-8.4" style="color: inherit; font-family: inherit; font-size: 24px; line-height: 40px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-3">8.4</span> Importing and exporting translation files</h3>
<div class="outline-text-3" id="text-8.4">
</div>
<div class="outline-4" id="outline-container-8.4.1">
<h4 id="sec-8.4.1" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.4.1</span> Translation files</h4>
<div class="outline-text-4" id="text-8.4.1">
<div style="margin-bottom: 10px;">
The translation files that are imported into the DB are retrieved from the repository of the corresponding projects. This is done by the scripts in the directory<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">get/</code>, which checkout (or update) these files from each projects' repository.</div>
<div style="margin-bottom: 10px;">
The way of getting these files is slightly different for different projects. However all of them are placed in the directory <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">$data_root</code>, which is defined in<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">config.sh</code>. Besides <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">$data_root</code>, <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">config.sh</code> defines also the variable <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">$languages</code>, which is a list of the codes of the languages that are supported by the system.</div>
<div style="margin-bottom: 10px;">
Projects on the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">$data_root</code> are also grouped (categorized) by origin. For example all the GNOME projects are placed on the same directory, all the KDE projects on another directory, and so on. Under the 'origin' directory, there is a subdirectory for each language, and under it usually there is a subdirectory for each project, containing all the translation files of the project, in any structure that is suitable for the project.</div>
<div style="margin-bottom: 10px;">
Some projects have just a single translation (PO) file (for example those of GNOME or ubuntu), some others have several translation files (like those of KDE), and some others have many translation files (like those of LibreOffice and Mozilla).</div>
<div style="margin-bottom: 10px;">
In the case of Mozilla, translation files are not in gettext format, so they are converted to PO files using <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">moz2po</code> (from Translation Toolkit).</div>
</div>
</div>
<div class="outline-4" id="outline-container-8.4.2">
<h4 id="sec-8.4.2" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.4.2</span> Importing</h4>
<div class="outline-text-4" id="text-8.4.2">
<div style="margin-bottom: 10px;">
Translation files are imported into the database by the scripts in the directory <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">import/</code>.</div>
<div style="margin-bottom: 10px;">
Importing is done in two steps: the first step is to import the template (POT) files of the project, and the second step is to import the translation (PO) files for each language. A POT file usually has a corresponding PO file for each language.</div>
<div style="margin-bottom: 10px;">
The template (POT) files contain the translatable strings of the project, with empty translations (this is why they are called templates). The translation (PO) files contain the same strings as the POT files, but with the corresponding translations for a certain language. In the import scripts, usually the French (fr) translation files are used as template files.</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li id="sec-8.4.2.1">Importing template files (pot_import.php)<br /><div style="margin-bottom: 10px;">
Template files are imported by <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pot_import.php</code>, which is called like this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./pot_import.php
Usage: ./pot_import.php origin project tplname file.pot
origin -- The origin of the project (ubuntu, GNOME, KDE, LibreOffice, etc.)
project -- The name of the project that is being imported.
tplname -- The name of the PO template.
file.pot -- The POT file of the project.
Examples:
./pot_import.php KDE kdeedu kturtle test/kturtle.pot
./pot_import.php KDE kdeedu kturtle test/kturtle_fr.po
</pre>
<div style="margin-bottom: 10px;">
<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pot_import.php</code> creates a new template and a new project (if needed). If the given <span style="text-decoration: underline;">origin+project</span> already exists, then the existing project is used. However, if the given template already exists (for this project), then it is deleted first (along with the locations and files related to it), and then recreated.</div>
<div style="margin-bottom: 10px;">
Along with the template, locations that are contained in this template are created as well. The string corresponding to each location is created only if it does not already exist. Otherwise the existing string is referenced instead (and the reference count of the string is incremented).</div>
</li>
<li id="sec-8.4.2.2">Importing translation files (po_import.php)<br /><div style="margin-bottom: 10px;">
Translation files are imported by <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">po_import.php</code>, which is called like this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./po_import.php
Usage: ./po_import.php origin project tplname lng file.po
origin -- The origin of the project (ubuntu, GNOME, KDE, LibreOffice, etc.)
project -- The name of the project.
tplname -- The name of the PO template.
lng -- The language of translation (de, fr, sq, en_GB, etc.).
file.po -- The PO file to be imported.
Example:
./po_import.php KDE kdeedu kturtle fr test/kturtle.po
</pre>
<div style="margin-bottom: 10px;">
<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">po_import.php</code> imports a new PO (translation) file. It assumes that the POT file of the project has already been imported, otherwise it will quit without doing anything. If the file has been already imported, then it is skipped.</div>
<div style="margin-bottom: 10px;">
For each file, all the information that is needed for exporting it is stored, like the file name and path, the headers of the file, the content of the file, etc.</div>
<div style="margin-bottom: 10px;">
Along with the file, it also inserts the translations for the corresponding strings, when such translations do not exist.</div>
</li>
<li id="sec-8.4.2.3">Import example (pingus.sh)<br /><div style="margin-bottom: 10px;">
The most simple example of importing a project is <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pingus.sh</code>. The other scripts import many projects from the same origin at once, and have logic about getting the project name, finding the files, etc. Also, they may have several (or many) template files for each project, which makes the logic even more complex.</div>
<div style="margin-bottom: 10px;">
The basic import code of <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pingus.sh</code> is this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">### make last snapshots before re-import
make-last-snapshot $origin $project fr
make-last-snapshot $origin $project sq
### import the template
potemplate=pingus
./pot_import.php $origin $project $potemplate $po_dir/pingus-fr.po
### import the PO files
./po_import.php $origin $project $potemplate fr $po_dir/pingus-fr.po
./po_import.php $origin $project $potemplate sq $po_dir/pingus-sq.po
## make initial snapshots after (re)import
make-snapshot $origin $project fr $po_dir/pingus-fr.po
make-snapshot $origin $project sq $po_dir/pingus-sq.po
</pre>
<div style="margin-bottom: 10px;">
The main import code is: importing first the template, and then importing the translation file for each language. However, before the import we <i>make a last snapshot</i> of the existing project, and after the import we also <i>make a snapshot</i>. These two functions, <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make-last-snapshot</code> and <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make-snapshot</code> are defined on <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make-snapshot.sh</code>, which is included in <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pingus.sh</code>. They will be discussed in more details in the section about the snapshots and diffs.</div>
</li>
<li id="sec-8.4.2.4">Import scripts<br /><div style="margin-bottom: 10px;">
The other scripts in the directory import are used to import projects from a certain origin. For example <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">kde.sh</code> imports (or re-imports) all the KDE projects,<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">office.sh</code> imports/re-imports all the LibreOffice projects, and so on.</div>
<div style="margin-bottom: 10px;">
If a list of projects is passed on the command-line to these scripts, then only the specified projects will be imported (instead of all the projects.)</div>
</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-8.4.3">
<h4 id="sec-8.4.3" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.4.3</span> Exporting</h4>
<div class="outline-text-4" id="text-8.4.3">
<div style="margin-bottom: 10px;">
As we have seen, besides the strings and translations, the import of PO files saves also the structure of these files and all the relevant data that are needed to export them again from the DB.</div>
<div style="margin-bottom: 10px;">
Export scripts are in the directory <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">export/</code>.</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li id="sec-8.4.3.1">Exporting PO files (po_export.php)<br /><div style="margin-bottom: 10px;">
The script <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">po_export.php</code> is used to export a single PO file. It is used like this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./po_export.php
Usage: ./po_export.php origin project tplname lng [file.po [export_mode]]
origin -- the origin of the project (ubuntu, GNOME, KDE, etc.)
project -- the name of the project to be exported
tplname -- The name of the PO template.
lng -- translation to be exported (de, fr, sq, en_GB, etc.)
file.po -- output file (stdout if not given)
export_mode -- 'most_voted' (default) or 'original'
The export mode 'most_voted' (which is the default one) exports the
most voted translations and suggestions.
The export mode 'original' exports the translations of the original
file that was imported (useful for making an initial snapshot of
the project).
If the export mode is not given as an argument, then the env variable
PO_EXPORT_MODE will be tried.
Examples:
./po_export.php KDE kdeedu kturtle fr > test/kturtle_fr.po
./po_export.php KDE kdeedu kturtle fr test/kturtle_fr.po original
</pre>
<div style="margin-bottom: 10px;">
The PO file to be exported is identified by <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">{origin, project, tplname, lng}</code>.</div>
<div style="margin-bottom: 10px;">
If the export mode is <i>original</i>, then the same translations that were imported are exported again. This is useful for making initial snapshots and diffs, which we will discuss later. However it should be noted that the exported file is not exactly the same as the imported file. One reason is that the formatting can be different, although the strings and translations are the same. Another reason is that during import some entries are skipped. like 'translator-credits' etc.</div>
<div style="margin-bottom: 10px;">
If the export mode is <i>most_voted</i>, and some of the translations have been voted, then the most voted translation is exported instead. This is how the input/feedback of the reviewers is transferred into the PO files. But since the formatting of the exported file is not exactly the same as the imported file, this exported file cannot be used directly to be committed to the project repository. Instead it is merged somehow with the existing PO file of the project. This merge can be simply done by <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">msgmerge</code>, or by tools like <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">lokalize</code> that facilitate merging of PO files. Another option is to get the differences between the exported file and the original file and to apply them to the current PO file.</div>
</li>
<li id="sec-8.4.3.2">Exporting projects (export.sh)<br /><div style="margin-bottom: 10px;">
To export all the PO files of a project, the script <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">export.sh</code> is used:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./export.sh
Usage: ./export.sh origin project lng output_dir
</pre>
<div style="margin-bottom: 10px;">
If <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">project==all</code>, then all the projects of the given origin will be exported. It the environments variable QUIET is defined, then it will be less verbose (will not output much progress/debug info).</div>
<div style="margin-bottom: 10px;">
The exported files are saved under the directory <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">output_dir</code>. Their path under the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">output_dir</code> is the same as the path of the imported files. This is useful for making diffs with the original files of the project.</div>
</li>
<li id="sec-8.4.3.3">Exporting projects in tgz format (export_tgz.sh)<br /><div style="margin-bottom: 10px;">
This script is usually called from the web (through the REST API) to export all the PO files of a project, in .tgz format.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./export_tgz.sh
Usage: ./export_tgz.sh origin project lng [output_dir]
</pre>
<div style="margin-bottom: 10px;">
If project==all, then all the projects of the given origin will be exported. If the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">output_dir</code> is not given, then the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">/tmp</code> directory will be used.</div>
<div style="margin-bottom: 10px;">
It outputs the path of the created archive.</div>
</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-8.4.4">
<h4 id="sec-8.4.4" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.4.4</span> Snapshots and diffs</h4>
<div class="outline-text-4" id="text-8.4.4">
<div style="margin-bottom: 10px;">
A <i>snapshot</i> is an export from the DB of the current PO files of a project-language. This export (which is a .tgz archive) is stored in the DB. A project has a snapshot for each language. Snapshots are useful for generating the <i>diffs</i>.</div>
<div style="margin-bottom: 10px;">
A <i>diff</i> is the difference between the snapshot and the previous snapshot. The diffs are stored in the DB as well. They are sequentially numbered and keep the history of changes.</div>
<div style="margin-bottom: 10px;">
There are two types of diffs that are generated and stored. One is the <i>unified diff</i> (<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">diff -u</code>) and the other the <i>embedded diff</i> (generated by pology<a href="http://websvn.kde.org/trunk/l10n-support/pology/" style="color: #0088cc; text-decoration: none;">http://websvn.kde.org/trunk/l10n-support/pology/</a>)</div>
<div style="margin-bottom: 10px;">
Diffs ensure that translators get only the latest feedback (since the last snapshot), without having to review again the suggestions made previously. So, they make easier the work of the translators. However the previous diffs are saved in the DB as well, in order to have a full history of the suggested translations over the time.</div>
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li id="sec-8.4.4.1">Keeping diffs in the DB (db_diff.php)<br /><div style="margin-bottom: 10px;">
The script <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db_diff.php</code> is used to <i>add</i>, <i>list</i> or <i>get</i> the diffs from the DB. It is just an interface to the DB.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./db_diff.php
Usage: ./db_diff.php add origin project lng file.diff file.ediff [comment [user_id]]
./db_diff.php list origin project lng
./db_diff.php get origin project lng number (diff|ediff) [file]
origin -- the origin of the project (ubuntu, GNOME, KDE, etc.)
project -- the name of the project to be exported
lng -- language of translation (de, fr, sq, en_GB, etc.)
file.diff -- file in `diff -u` format
file.ediff -- file in ediff (embedded diff) format
comment -- optional comment about the ediff file that is being added
user_id -- optional (drupal) uid of the user that is adding the ediff
number -- the number of ediff that is being retrieved
Examples:
./db_diff.php add LibreOffice sw fr LibreOffice-sw-fr.diff LibreOffice-sw-fr.ediff
./db_diff.php list LibreOffice sw fr
./db_diff.php get LibreOffice sw fr 5 diff > LibO/fr/sw_5.diff
./db_diff.php get LibreOffice sw fr 5 ediff > LibO/fr/sw_5.ediff
</pre>
<div style="margin-bottom: 10px;">
This script is usually called from other scripts (not directly from the command line).</div>
</li>
<li id="sec-8.4.4.2">Keeping snapshots in the DB (db_snapshot.php)<br /><div style="margin-bottom: 10px;">
The script <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db_snapshot.php</code> is used as a DB interface for the snapshots.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./db_snapshot.php
Usage: ./db_snapshot.php (init|update|get) origin project lng file.tgz
origin -- the origin of the project (ubuntu, GNOME, KDE, etc.)
project -- the name of the project to be exported
lng -- language of translation (de, fr, sq, en_GB, etc.)
file.tgz -- tgz archive of the snapshot of the project
The operation 'init' is used to insert into the DB the snapshot
for the first time. The operation 'update' to update it, and
'get' to retrive it from the DB.
Examples:
./db_snapshot.php init LibreOffice sw fr LibreOffice-sw-fr.tgz
./db_snapshot.php update LibreOffice sw fr LibreOffice-sw-fr.tgz
./db_snapshot.php get LibreOffice sw fr LibreOffice-sw-fr.tgz
</pre>
<div style="margin-bottom: 10px;">
The operation <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">init</code> will first delete a snapshot, if it already exists in the DB. This script is usually called from other scripts (not directly from the command line).</div>
</li>
<li id="sec-8.4.4.3">Making a diff (make_diff.sh)<br /><div style="margin-bottom: 10px;">
This script compares the current translation files of an <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">{origin, project, lng}</code> with the last snapshot.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./make_diff.sh
Usage: ./make_diff.sh origin project lng
Export the current state of translation files of a project-language
and make a diff with the last snapshot.
</pre>
<div style="margin-bottom: 10px;">
It does these:</div>
<ol style="margin: 0px 0px 0px 25px; padding: 0px;">
<li>Export the current files for the given <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">{origin, project, lng}</code> (by calling <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">export.sh</code>)</li>
<li>Get the (last) snapshot for <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">{origin, project, lng}</code></li>
<li>Make the difference between them with <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">diff -rubB</code> and with <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">pology</code></li>
</ol>
<div style="margin-bottom: 10px;">
When it is done, it leaves in its own directory the files <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.tgz</code> (which contains the exported files), <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.diff</code> and<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.ediff</code>.</div>
<div style="margin-bottom: 10px;">
It outputs some debug information as well, but if the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">QUIET</code> environment variable is define, this output is suppressed.</div>
</li>
<li id="sec-8.4.4.4">Making a snapshot (make_snapshot.sh)<br /><pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./make_snapshot.sh
Usage: ./make_snapshot.sh origin project lng [diff_comment]
Make the diff with the last snapshot and store it in DB.
Save in DB the current snapshot.
</pre>
<div style="margin-bottom: 10px;">
This script just calls <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make_diff.sh</code> and stores in DB the files <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.diff</code> and <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.ediff</code>, if they are not empty. It also updates the snapshot of <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">{origin, project, lng}</code> with the file <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">origin-project-lng.tgz</code>. Finally it cleans all the three files generated by <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make_diff.sh</code>.</div>
<div style="margin-bottom: 10px;">
<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make_diff.sh</code> is separated from <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make_snapshot.sh</code> because it needs to be used also by the REST API<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">translations/project/diff/origin/project/lng/-</code> to generate the changes (diffs) since the last snapshot.</div>
</li>
<li id="sec-8.4.4.5">Lifecycle of the diffs and snapshots<br /><div style="margin-bottom: 10px;">
When a project is imported, an initial snapshot is created and stored in the DB as well. This initial snapshot contains the original files that were used for the import. It is done like this:</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">### store the tgz file into the DB as a snapshot
../export/db_snapshot.php init $origin $project $lng $snapshot_tgz
</pre>
<div style="margin-bottom: 10px;">
Immediately after the initial snapshot, another snapshot is done, by exporting files in the <i>original</i> mode.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">### make a second snapshot, which will generate a diff
### with the initial snapshot, and will save it into the DB
export PO_EXPORT_MODE='original' ## set the export mode for po_export.php
diff_comment="Import diff. Contains formating changes, any skipped entries, etc."
../export/make_snapshot.sh $origin $project $lng "$diff_comment"
</pre>
<div style="margin-bottom: 10px;">
This snapshot will also generate a diff, which contains the differences that come as a result of formatting changes between the original format and the exported format. It also contains the entries that are skipped during the import.</div>
<div style="margin-bottom: 10px;">
Whenever a translator checks the latest diff, he should also make a snapshot, which will also generate the diff with the previous snapshot (and store it on the DB). As a result, the translations that have been already suggested to him will not be suggested again.</div>
<div style="margin-bottom: 10px;">
When the time comes to re-import a project, a last snapshot is made automatically before the import, in order to store as a diff any latest (unchecked) suggestions.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">### make a last snapshot before the import (useful in the case of re-import)
export PO_EXPORT_MODE='most_voted' ## set the export mode for po_export.php
diff_comment="Contains the latest suggestions before import."
../export/make_snapshot.sh $origin $project $lng "$diff_comment"
</pre>
<div style="margin-bottom: 10px;">
Then an initial snapshot is made again with the original files, using <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db_snapshot.php init ...</code> (which will not generate any diff). After it, a snapshot using the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">original</code> mode of export is made again, which will generate again any formatting changes and save them as a diff.</div>
<div style="margin-bottom: 10px;">
However, in the case of re-import, another snapshot is needed, using the <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">most_voted</code> mode of export, which will generate a diff that contains all the feedback and suggestions made before the re-import.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">### make another snapshot, which will contain all the previous suggestions
### (before the import), in a single diff
export PO_EXPORT_MODE='most_voted' ## set the export mode for po_export.php
diff_comment="Initial diff after import. Contains all the previous suggestions (before the last import)."
../export/make_snapshot.sh $origin $project $lng "$diff_comment"
</pre>
<div style="margin-bottom: 10px;">
Usually this diff contains the suggestions that the translator has already rejected, and making this snapshot ensures that they are not suggested again to him.</div>
<div style="margin-bottom: 10px;">
This logic of the initial snapshots and diffs is applied by calling the functions <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make-last-snapshot()</code> and <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">make-snapshot()</code>, which are defined on the file<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">import/make-snapshot.sh</code>. They are included and called automatically by the import scripts, before and after each import.</div>
</li>
<li id="sec-8.4.4.6">Getting diffs from the web (wget_diff.sh)<br /><div style="margin-bottom: 10px;">
This script can be used by the translators to get the diffs of the projects from the server, through the REST API.</div>
<pre class="example" style="background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 13px; margin-bottom: 10px; overflow: auto; padding: 9.5px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;">$ ./wget-diffs.sh
Usage: ./wget-diffs.sh origin project lng [nr]
Get the diffs of a project using wget and the REST API.
If 'nr' is missing, then the list of diffs will be retrieved instead.
If 'nr' is '-', then the latest diffs (since the last snapshot)
will be computed and returned (it will take longer to execute, since
the diffs are calculated on the fly).
Examples:
./wget-diffs.sh KDE kdelibs sq
./wget-diffs.sh KDE kdelibs sq 1
./wget-diffs.sh KDE kdelibs sq 2
./wget-diffs.sh KDE kdelibs sq -
</pre>
</li>
</ul>
</div>
</div>
<div class="outline-4" id="outline-container-8.4.5">
<h4 id="sec-8.4.5" style="color: inherit; font-family: inherit; font-size: 18px; margin: 10px 0px; text-rendering: optimizelegibility;">
<span class="section-number-4">8.4.5</span> Misc</h4>
<div class="outline-text-4" id="text-8.4.5">
<ul style="margin: 0px 0px 10px 25px; padding: 0px;">
<li id="sec-8.4.5.1">Connecting to the DB<br /><div style="margin-bottom: 10px;">
The files <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">*.db.php</code> contain DB classes that encapsulate the interaction of import/export scripts with the database of the application. All of them extend<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db/class.DB.php</code>, which creates a connection to the database. The parameters of the DB connection are included from <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db/settings.php</code>, which is generated automatically during installation. The shell scripts use <code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">db/sql-connect.txt</code> instead, for getting the connection parameters.</div>
</li>
<li id="sec-8.4.5.2">Working with PO files<br /><div style="margin-bottom: 10px;">
<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">gettext/POParser.php</code> is a parser used to extract the data from a PO/POT file, in order to import them into the DB . It is taken from:<a href="http://code.google.com/p/php-po-parser/issues/detail?id=2" style="color: #0088cc; text-decoration: none;">http://code.google.com/p/php-po-parser/issues/detail?id=2</a> It makes no validity checks, but this is OK, since the PO files that are imported are supposed to be valid. (Anyway, if needed, PO files can be checked with msgfmt before being imported).</div>
<div style="margin-bottom: 10px;">
<code style="background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #dd1144; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace; font-size: 12px; padding: 2px 4px;">gettext/POWriter.php</code> is used during export to generate a PO file from the projects, locations, strings and translations that are stored in the DB.</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="postamble" style="background-color: white; color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;">
<div class="author" style="margin-bottom: 10px;">
Author: Dashamir Hoxha <a href="mailto:dashohoxha@gmail.com" style="color: #0088cc; text-decoration: none;"><dashohoxha@gmail.com></a></div>
<div class="date" style="margin-bottom: 10px;">
Date: 2012-08-28 11:47:56 CEST</div>
<div class="creator" style="margin-bottom: 10px;">
HTML generated by org-mode 6.33x in emacs 23</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-54079235436828606222012-08-23T10:23:00.001+02:002012-11-22T15:30:04.937+01:00How to Secure a Ubuntu Server<div dir="ltr" style="text-align: left;" trbidi="on">
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
Recently I purchased a virtual ubuntu server on<span class="Apple-converted-space"> </span><a _mce_href="http://www.rackspace.com/cloud/public/servers/pricing/" href="http://www.rackspace.com/cloud/public/servers/pricing/">rackspace</a>.
However I have to manage it myself, and this includes first of all
taking care for its security. Securing it is very important and is the
first thing to be done, since all the rackspace servers have public IP-s
and so are open to all the possible attacks from the Internet. Here I
will describe some of the steps that can be done to secure the server.<br />
<a name='more'></a></div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-1" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-1">
<span class="section-number-2">1.</span><span class="Apple-converted-space"> </span>Login to the Server</h2>
<div class="outline-text-2" id="text-1">
Initially you can login as user<span class="Apple-converted-space"> </span><strong>root</strong>, through<span class="Apple-converted-space"> </span><strong>ssh</strong>:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">ssh root@123.45.67.890
</pre>
Then you can change the password of the<span class="Apple-converted-space"> </span><em>root</em><span class="Apple-converted-space"> </span>(from the default one, assigned by<span class="Apple-converted-space"> </span><em>rackspace</em>), with the command<span class="Apple-converted-space"> </span><code>passwd</code>.</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-2" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-2">
<span class="section-number-2">2</span><span class="Apple-converted-space">. </span>Add an Admin User</h2>
<div class="outline-text-2" id="text-2">
It is a common practice in Linux (and specially in ubuntu) to lock down the<span class="Apple-converted-space"> </span><strong>root</strong><span class="Apple-converted-space"> </span>account and to use another account for administrative tasks. Let's see how we can create it.<br />
<ul>
<li>First create another user account:
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">adduser administrator
</pre>
</li>
<li>Then assign the<span class="Apple-converted-space"> </span><em>administrative</em><span class="Apple-converted-space"> </span>user<span class="Apple-converted-space"> </span><strong>sudo</strong><span class="Apple-converted-space"> </span>priviledges (by adding it to the the group<span class="Apple-converted-space"> </span><em>sudo</em>):
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">adduser administrator sudo
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-3" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-3">
<span class="section-number-2">3.</span><span class="Apple-converted-space"> </span>Set Up Public and Private Keys</h2>
<div class="outline-text-2" id="text-3">
One effective way of securing SSH access to your Cloud Server is to
use a public/private key. This means that a public key is placed on the
server and the private key is on your local workstation. This makes it
impossible for someone to log in using just a password - they must
have the private key. This consists of 3 basic steps: create the key on
your local workstation, copy the public key to the Cloud Server, and
set the correct permissions for the key.<br />
<ol>
<li>Create the public and private keys on you personal (local) computer:
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">mkdir ~/.ssh
ssh-keygen -t rsa
cd ~/.ssh/
mv id_rsa rackspace_rsa
</pre>
If you do not want a passphrase then just press enter when prompted. The<span class="Apple-converted-space"> </span><strong>id_rsa</strong><span class="Apple-converted-space"> </span>and<span class="Apple-converted-space"> </span><strong>id_rsa.pub</strong><span class="Apple-converted-space"> </span>are created in the<span class="Apple-converted-space"> </span><strong>.ssh</strong><span class="Apple-converted-space"> </span>directory. The<span class="Apple-converted-space"> </span><strong>id_rsa.pub</strong><span class="Apple-converted-space"> </span>file holds the public key. You'll place this file on you server. The<span class="Apple-converted-space"> </span><strong>id_rsa</strong><span class="Apple-converted-space"> </span>file is your private key. Never show, give away, or keep this file on a public computer. We rename it to<span class="Apple-converted-space"> </span><strong>rackspace_rsa</strong><span class="Apple-converted-space"> </span>to make it obvious that this is the private key that is used to access the rackspace server.<br />
</li>
<li>Copy the public key to the remote server:
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">scp ~/.ssh/id_rsa.pub administrator@123.45.67.890:/home/administrator/
</pre>
</li>
<li>Modify ssh permissions (on the remote server):
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">ssh administrator@123.45.67.890
mkdir /home/administrator/.ssh
mv /home/administrator/id_rsa.pub /home/administrator/.ssh/authorized_keys
chown -R administrator: /home/administrator/.ssh
chmod 700 /home/administrator/.ssh
chmod 600 /home/administrator/.ssh/authorized_keys
</pre>
</li>
</ol>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-4" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-4">
<span class="section-number-2">4</span><span class="Apple-converted-space">. </span>Modify the SSH Configuration</h2>
<div class="outline-text-2" id="text-4">
Keeping the SSH service on the default port of 22 makes it an easy
target. It is recommended to change the default SSH configuration to
make it more secure. There are also some other configuration options
that are used to lock down the ssh access to the server.<br />
Modify the file<span class="Apple-converted-space"> </span><code>/etc/ssh/sshd_config</code><span class="Apple-converted-space"> </span>by adding or editing these lines:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">Port 1234 # change ssh port to 1234
Protocol 2
PermitRootLogin no # user root is not allowed to log in
PasswordAuthentication no # disable password login, only the private key is accepted
UseDNS no
AllowUsers administrator # only user administrator is allowed to log in
</pre>
Not all of these options are required, they overlap each-other, and
you can choose which ones to use depending on your case and your
security/flexibility requirements.<br />
We need to restart the<span class="Apple-converted-space"> </span><strong>sshd</strong><span class="Apple-converted-space"> </span>service in order to enable these changes:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">service ssh restart
</pre>
After applying the changes, login from a second terminal (without
logging out from the first one), in order to make sure that you can
still login and you didn't lock yourself out of the server. Now you can
login like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">ssh -i ~/.ssh/rackspace_rsa -p 1234 administrator@123.45.67.890
</pre>
So, we use the key<span class="Apple-converted-space"> </span><strong>~/.ssh/rackspace_rsa</strong><span class="Apple-converted-space"> </span>for authentication, access the ssh server on the port<span class="Apple-converted-space"> </span><strong>1234</strong>, and login as user<span class="Apple-converted-space"> </span><strong>administrator</strong>.<br />
By the way, in case that we need to copy something through<span class="Apple-converted-space"> </span><strong>scp</strong>, we can use a command like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">scp -i ~/.ssh/rackspace_rsa -P 1234 source_file administrator@123.45.67.890:destination_file
</pre>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-5" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-5">
<span class="section-number-2">5.</span><span class="Apple-converted-space"> </span>Setup a Firewall</h2>
<div class="outline-text-2" id="text-5">
For simple firewalls,<span class="Apple-converted-space"> </span><strong>ufw</strong><span class="Apple-converted-space"> </span>is a great tool for building them easily. Let's say that we would like to allow only the ports<span class="Apple-converted-space"> </span><strong>80</strong>,<span class="Apple-converted-space"> </span><strong>443</strong>, and<span class="Apple-converted-space"> </span><strong>1234</strong><span class="Apple-converted-space"> </span>(don't forget to allow the<span class="Apple-converted-space"> </span><strong>ssh</strong><span class="Apple-converted-space"> </span>port, otherwise you can lock yourself out!). We can build the firewall like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid #aebdcc; font-family: courier, monospace; font-size: 14px; overflow: auto; padding: 5pt;">ssh -i ~/.ssh/rackspace_rsa -p 1234 administrator@123.45.67.890
ufw allow 1234
ufw allow 80
ufw allow 443
ufw enable
</pre>
If you are familiar with<span class="Apple-converted-space"> </span><strong>iptables</strong>, then you may want to check out the iptables' rules that<span class="Apple-converted-space"> </span><strong>ufw</strong><span class="Apple-converted-space"> </span>has built, by using<span class="Apple-converted-space"> </span><strong>iptables-save</strong>.</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-6" style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-6">
<span class="section-number-2">6.</span><span class="Apple-converted-space"> </span>Referencies:</h2>
<div class="outline-text-2" id="text-6">
<ul>
<li><a _mce_href="http://www.rackspace.com/knowledge_center/article/configuring-basic-security-0" href="http://www.rackspace.com/knowledge_center/article/configuring-basic-security-0">http://www.rackspace.com/knowledge\_center/article/configuring-basic-security-0</a></li>
<li><a _mce_href="http://www.linode.com/wiki/index.php/Configuring_IPtables_on_ubuntu_server" href="http://www.linode.com/wiki/index.php/Configuring_IPtables_on_ubuntu_server">http://www.linode.com/wiki/index.php/Configuring\_IPtables\_on\_ubuntu\_server</a></li>
</ul>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-43920844322497071222012-08-22T09:29:00.001+02:002013-04-25T19:08:15.152+02:00Improving the Performance of a VM by Using a Real Disk Partition<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<span _mce_style="font-family: Times, serif; font-size: 16px;" style="font-family: Times, serif; font-size: 16px;">I have used </span><a _mce_href="http://www.zentyal.com" _mce_style="font-family: Times, serif; font-size: 16px;" href="http://www.zentyal.com/" style="font-family: Times, serif; font-size: 16px;">zentyal</a><span _mce_style="font-family: Times, serif; font-size: 16px;" style="font-family: Times, serif; font-size: 16px;"> as a gateway server, and it is actually running on a virtual machine. An important component of it is </span><a _mce_href="http://www.squid-cache.org/" _mce_style="font-family: Times, serif; font-size: 16px;" href="http://www.squid-cache.org/" style="font-family: Times, serif; font-size: 16px;">squid</a><span _mce_style="font-family: Times, serif; font-size: 16px;" style="font-family: Times, serif; font-size: 16px;">, which is supposed to improve the efficiency of the network connection by saving in cache the web pages that have been already visited, and fetching them from the cache when they are re-visited.</span></div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
This is an operation that makes intesive usage of the disk, and virtual disks (used on virtual machines) are not particularly efficient for it. However, a virtual machine can also use a real partition, so the efficience of squid can be improved by attaching a real partition to the virtual machine and using it for the cache.<br />
<a name='more'></a></div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-1" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-1" style="font-size: 1.5em;">
Attach a Real Partition to the Virtual Machine</h2>
<div class="outline-text-2" id="text-1">
The host where zentyal is installed is a CentOS system, and the disk partitions are managed by LVM. So, first of all we should create a new LVM partition to be attached to the virtual machine:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">vgdisplay
lvdisplay
lvcreate vg_data -L 50G -n /dev/vg_data/lv_cache
</pre>
In LVM, <strong>Volume Groups (VG)</strong> are the equivalents of <strong>disks</strong>, and <strong>Logical Volumes (LV)</strong> are the equivalents of <strong>partitions</strong>. In this case, we are creating a<em>logical volume</em> with name <strong>/dev/vg_data/lv_cache</strong>, on the <em>volume group</em> with name <strong>vg_data</strong>. The size of this LV partition is <strong>50G</strong>, and this is enough for the squid cache.<br />
Then we add this partition to the configuration file of the virtual machine <code>/etc/libvirt/qemu/zentyal.xml</code>:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;"><devices>
. . . . .
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/vg_data/lv_cache'/>
<target dev='sdb' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='1'/>
</disk>
. . . . .
</devices>
</pre>
Inside the virtual machine this disk will appear and will be accessed as <strong>/dev/sdb</strong>.<br />
Now we have to enable it, by reloading (re-defining) the configuration file:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh define /etc/libvirt/qemu/zentyal.xml
virsh shutdown zentyal
virsh start zentyal
</pre>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-2" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-2" style="font-size: 1.5em;">
Using the New Disk Inside the Virtual Machine</h2>
<div class="outline-text-2" id="text-2">
Inside the virtual machine (zentyal), we can access the new disk as <strong>/dev/sdb</strong>. First we have to format and mount it, and then we can change the <em>squid</em>configuration to use it.<br />
<ul>
<li>Format the new partition with the <em>reiserfs</em> format (which is a recommended format for the squid cache):<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">mkfs.reiserfs -f /dev/sdb
</pre>
</li>
<li>Append this line to <code>/etc/fstab</code>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">/dev/sdb /var/spool/squid reiserfs defaults,notail,noatime 1 2
</pre>
</li>
<li>Then stop squid and mount the new partition:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">service squid stop
rm -rf /var/spool/squid/*
mount -a
chown proxy:proxy /var/spool/squid/
chmod 750 /var/spool/squid/
squid -z
service squid start
</pre>
</li>
<li>Edit <code>/usr/share/zentyal/stubs/squid/squid.conf.mas</code> and change this line:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">cache_dir ufs /var/spool/squid <% $cacheDirSize %> 16 256
</pre>
to this one (by adding an <strong>a</strong> option):<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">cache_dir aufs /var/spool/squid <% $cacheDirSize %> 16 256
</pre>
Then restart:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">service squid restart
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-3" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-3" style="font-size: 1.5em;">
Referencies:</h2>
<div class="outline-text-2" id="text-3">
<ul>
<li><a _mce_href="http://tecnologia.2020mobile.es/improving-zentyal-proxy-performance-squid-dansguardian/" href="http://tecnologia.2020mobile.es/improving-zentyal-proxy-performance-squid-dansguardian/">http://tecnologia.2020mobile.es/improving-zentyal-proxy-performance-squid-dansguardian/</a></li>
<li><a _mce_href="http://www.linux-faqs.com/squid.php" href="http://www.linux-faqs.com/squid.php">http://www.linux-faqs.com/squid.php</a></li>
<li><a _mce_href="http://sourcelinux.wikidot.com/setting-up-squid-in-gateway-as-a-transparent-proxy" href="http://sourcelinux.wikidot.com/setting-up-squid-in-gateway-as-a-transparent-proxy">http://sourcelinux.wikidot.com/setting-up-squid-in-gateway-as-a-transparent-proxy</a></li>
<li><a _mce_href="http://daddy-linux.blogspot.com/2012/03/configuring-squid-proxy-server.html" href="http://daddy-linux.blogspot.com/2012/03/configuring-squid-proxy-server.html">http://daddy-linux.blogspot.com/2012/03/configuring-squid-proxy-server.html</a></li>
<li><a _mce_href="http://en.kioskea.net/faq/804-ubuntu-installing-an-http-proxy-server-squid" href="http://en.kioskea.net/faq/804-ubuntu-installing-an-http-proxy-server-squid">http://en.kioskea.net/faq/804-ubuntu-installing-an-http-proxy-server-squid</a></li>
<li><a _mce_href="http://doc.zentyal.org/en/proxy.html" href="http://doc.zentyal.org/en/proxy.html">http://doc.zentyal.org/en/proxy.html</a></li>
</ul>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-5060876543289708012012-08-20T06:41:00.001+02:002013-04-25T19:09:39.433+02:00Virtual Machine Management on Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<div _mce_style="font-family: Times, serif; font-size: 16px;" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
Installing virtual machines on a ubuntu server, managing them from a ubuntu desktop, and some other tips.<br />
<a name='more'></a></div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" id="table-of-contents" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 style="font-size: 1.5em;">
Table of Contents</h2>
<div id="text-table-of-contents">
<ol>
<li>Prepare a Ubuntu Server as a Virtual Machine Host</li>
<li>Configure the Bridge Interface on the Host Machine</li>
<li>Create a Virtual Machine</li>
<li>Define a Virtual Machine</li>
<li>Manage Virtual Machines from Ubuntu Desktop</li>
<li>Convert virtual disks from raw format to qcow2</li>
<li>Migrating from VMWare to KVM</li>
<li>How to mount a qcow2 image<img _mce_src="http://posterous.com/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif" class="mcePageBreak mceItemNoResize" src="http://posterous.com/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif" style="background-color: white; background-image: url(http://posterous.com/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif); background-position: 50% 0%; background-repeat: no-repeat no-repeat; border-top-color: rgb(204, 204, 204); border-top-style: dotted; border-width: 1px 0px 0px; display: block; height: 12px; margin-top: 15px; width: 527px;" /></li>
</ol>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-1" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-1" style="font-size: 1.5em;">
<span class="section-number-2">1.</span> Prepare a Ubuntu Server as a Virtual Machine Host</h2>
<div class="outline-text-2" id="text-1">
A <strong>host</strong> is a system on top of which virtual machines run. Let's see how to prepare a ubuntu server as a virtual machine host.<br />
<ul>
<li>Check whether the CPU supports the hardware virtualization:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">egrep '(vmx|svm)' --color=always /proc/cpuinfo
</pre>
</li>
<li>Enable virtualization on the BIOS setup.</li>
<li>Install KVM and vmbuilder:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">apt-get install ubuntu-virt-server python-vm-builder kvm-pxe
</pre>
</li>
<li>Add the user as which we're currently logged in (root) to the group libvirtd:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">adduser `id -un` libvirtd
adduser `id -un` kvm
</pre>
</li>
<li>Check whether they have been successfully installed:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh -c qemu:///system list
</pre>
It should display something like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">root@server1:~# virsh -c qemu:///system list
Id Name State
----------------------------------
root@server1:~#
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a _mce_href="http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10" href="http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10">http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10</a></li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-2" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-2" style="font-size: 1.5em;">
<span class="section-number-2">2.</span> Configure the Bridge Interface on the Host Machine</h2>
<div class="outline-text-2" id="text-2">
The bridge interface on the host system allows the virtual machines to access the local network (LAN) directly and independently from the host machine, as if they were real machines.<br />
<ul>
<li>First install the bridge utils:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">apt-get install bridge-utils
</pre>
</li>
<li>Then add a bridge interface <strong>br0</strong> at <code>/etc/network/interfaces</code><pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">auto lo
iface lo inet loopback
auto br0
iface br0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
bridge_ports eth0
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
</pre>
</li>
<li>Finally restart the networking:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">sudo /etc/init.d/networking restart
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a _mce_href="https://help.ubuntu.com/11.10/serverguide/C/network-configuration.html#bridging" href="https://help.ubuntu.com/11.10/serverguide/C/network-configuration.html#bridging">https://help.ubuntu.com/11.10/serverguide/C/network-configuration.html#bridging</a></li>
<li><a _mce_href="http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10" href="http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10">http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-11.10</a></li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-3" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-3" style="font-size: 1.5em;">
<span class="section-number-2">3.</span> Create a Virtual Machine</h2>
<div class="outline-text-2" id="text-3">
<ul>
<li>Create a directory for the virtual machine on <code>/var/lib/libvirt/images/</code>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">cd /var/lib/libvirt/images/
mkdir vm1
cd vm1/
</pre>
</li>
<li>We will use the <code>vmbuilder</code> tool to create VMs, which uses a template to create virtual machines. This template is located in the<code>/etc/vmbuilder/libvirt/</code> directory and we make a copy of it:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">mkdir -p mytemplates/libvirt
cp /etc/vmbuilder/libvirt/* mytemplates/libvirt/
</pre>
</li>
<li>Define the partitions in the file <code>vmbuilder.partition</code> with a content like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">root 1000
swap 500
</pre>
</li>
<li>Create a script called <code>boot.sh</code> that will be executed when the VM is booted for the first time:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;"># This script will run the first time the virtual machine boots
# It is ran as root.
# Expire the user account
passwd -e admin
# Install openssh-server
apt-get update
apt-get install -qqy --force-yes openssh-server
</pre>
</li>
<li>Create the script <code>install.sh</code> with a content like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">#!/bin/bash
# --mirror=http://192.168.10.49/apt-mirror/archive.ubuntu.com/ubuntu \
# --iso=/data/iso/ubuntu-11.10-server-amd64.iso \
vmbuilder kvm ubuntu --suite=oneiric --flavour=virtual --arch=amd64 \
--iso=/data/iso/ubuntu-11.10-server-amd64.iso \
-o --libvirt=qemu:///system \
--ip=192.168.10.52 --gw=192.168.10.1 \
--part=vmbuilder.partition --templates=mytemplates \
--user=admin --name=Admin --pass=Admin \
--addpkg=vim-nox --addpkg=acpid \
--firstboot=/var/lib/libvirt/images/vm1/boot.sh \
--mem=256 --hostname=vm1 --bridge=br0
</pre>
</li>
<li>Run <code>install.sh</code> and do the installation. The disk images will be located in the <code>ubuntu-kvm/</code> subdirectory of our VM directory<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">ls -l /var/lib/libvirt/images/vm1/ubuntu-kvm/
</pre>
</li>
<li>Move the created disk image to the directory <code>/images/</code>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">mkdir -p /images/
mv ubuntu-kvm/tmpRwPa27.qcow2 /images/vm1.qcow2
</pre>
</li>
<li>Edit the file <code>/etc/libvirt/qemu/vm1.xml</code> and modify the path of the image, so that it looks like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;"><disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/images/vm1.qcow2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
</pre>
</li>
<li>Redefine the virtual machine:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh define /etc/libvirt/qemu/vm1.xml
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-4" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-4" style="font-size: 1.5em;">
<span class="section-number-2">4.</span> Define a Virtual Machine</h2>
<div class="outline-text-2" id="text-4">
Whenever the configuration of a virtual machine changes, it should be redefined (which means updating the registry of virtual machines with the latest configurations):<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh define /etc/libvirt/qemu/vm1.xml
virsh list --all
virsh start vm1
</pre>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-5" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-5" style="font-size: 1.5em;">
<span class="section-number-2">5.</span> Manage Virtual Machines from Ubuntu Desktop</h2>
<div class="outline-text-2" id="text-5">
The program <strong>virt-manager</strong> is a desktop (GUI) application, based on <strong>libvirt</strong>, which can be used to manage virtual machines even on remote hosts (through<strong>ssh</strong>). Let's see how to install and use it.<br />
<ul>
<li>Install the virtualization packages:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">sudo apt-get install qemu-kvm libvirt-bin virt-manager
</pre>
</li>
<li>Check that it is OK:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">kvm-ok
sudo kvm-ok
</pre>
</li>
<li>Manage local and remote virtual hosts:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh -c qemu:///system list
virsh -c qemu+ssh://admin@192.168.10.50/system list
virt-manager -c qemu:///system 127.0.0.1
virt-manager -c qemu+ssh://admin@192.168.10.50/system
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a _mce_href="http://www.itworld.com/virtualization/216949/crash-course-virtualization-kvm-ubuntu-server?page=0,1" href="http://www.itworld.com/virtualization/216949/crash-course-virtualization-kvm-ubuntu-server?page=0,1">http://www.itworld.com/virtualization/216949/crash-course-virtualization-kvm-ubuntu-server?page=0,1</a></li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-6" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-6" style="font-size: 1.5em;">
<span class="section-number-2">6.</span> Convert virtual disks from raw format to qcow2</h2>
<div class="outline-text-2" id="text-6">
The format <strong>qcow2</strong> has some advantages with respect to the <strong>raw</strong> format. For example it can be compressed, it can have <em>snapshots</em>, etc.<br />
<ul>
<li>Use <code>qemu-img convert</code> like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">cd /var/lib/libvirt/images/
qemu-img convert -c -O qcow2 vm1.img vm1.qcow2
</pre>
</li>
<li>Modify <code>/etc/libvirt/qemu/vm1.xml</code> like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;"><disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/var/lib/libvirt/images/vm1.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-7" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-7" style="font-size: 1.5em;">
<span class="section-number-2">7.</span> Migrating from VMWare to KVM</h2>
<div class="outline-text-2" id="text-7">
A virtual machine built with VMWare can be converted to KVM.<br />
<ul>
<li>Install the neccessary packages:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">aptitude install virt-goodies qemu-kvm kvm \
libvirt-bin ubuntu-vm-builder bridge-utils virt-top
</pre>
</li>
<li>Convert the disk image from format <em>vmdk</em> to <em>qcow2</em>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">qemu-img convert User-PC.vmdk -O qcow2 User-PC.qcow2
</pre>
</li>
<li>Convert the <em>vmx</em> file to format <em>xml</em>:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">vmware2libvirt -f User-PC.vmx > User-PC.xml
</pre>
</li>
<li>Change also the disk type and source file on <code>User-PC.xml</code> like this:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;"><disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/images/User-PC.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
</pre>
</li>
<li>Add this xml file to the VM manager:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh -c qemu:///system define User-PC.xml
</pre>
</li>
<li>Start it:<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">virsh start User-PC
</pre>
</li>
</ul>
Referencies:<br />
<ul>
<li><a _mce_href="http://blog.mymediasystem.net/uncategorized/vmware-kvm-migration-guide/" href="http://blog.mymediasystem.net/uncategorized/vmware-kvm-migration-guide/">http://blog.mymediasystem.net/uncategorized/vmware-kvm-migration-guide/</a></li>
</ul>
</div>
</div>
<div _mce_style="font-family: Times, serif; font-size: 16px;" class="outline-2" id="outline-container-8" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<h2 id="sec-8" style="font-size: 1.5em;">
<span class="section-number-2">8.</span> How to mount a qcow2 image</h2>
<div class="outline-text-2" id="text-8">
Sometimes we need to access directly the disk of a virtual machine, without booting it. It can be done by mounting it on the host system, as in the following example.<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border: 1pt solid rgb(174, 189, 204); color: black; font-family: courier, monospace; font-size: 14px; margin: 8px; overflow: auto; padding: 5pt;">modprobe nbd max_part=16
qemu-nbd -c /dev/nbd0 image.qcow2
partprobe /dev/nbd0
mount /dev/nbd0p1 /mnt/image
fdisk /dev/nbd0
vgscan
vgchange -ay vm1
lvdisplay
mount /dev/vm1/root /mnt/image
umount /mnt/image
vgchange -an vm1
killall qemu-nbd
</pre>
Reference: <a _mce_href="http://en.wikibooks.org/wiki/QEMU/Images" href="http://en.wikibooks.org/wiki/QEMU/Images">http://en.wikibooks.org/wiki/QEMU/Images</a><br />
<div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com2tag:blogger.com,1999:blog-5945244389322428562.post-80625021968592383412012-08-19T15:21:00.001+02:002012-08-23T23:24:04.630+02:00MikroTik Tips<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="posterous_autopost">
<div style="color: black; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: start; text-indent: 0px;">
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
Some tips about the configuration of a MikroTik router.</div>
<a name='more'></a><br /><br />
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-1">
<h2 id="sec-1">
<span class="section-number-2">1.</span> Starting the graphical configuration application</h2>
<div class="outline-text-2" id="text-1">
Althought MikroTik has a web interface, the desktop configuration application is much more advanced. In Linux it can be started through <strong>wine</strong> (Windows Emulator), like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">sudo apt-get install wine
wine winbox.exe
</pre>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-2">
<h2 id="sec-2">
<span class="section-number-2">2</span>. How to backup the configuration</h2>
<div class="outline-text-2" id="text-2">
A full, binary backup of the router can be done like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">ssh admin@192.168.1.1
/ system backup save name=mikrotik-20120130
exit
lftp admin@192.168.1.1
get mikrotik-20120130.backup
quit
</pre>
In case that someting goes wrong, restore it with:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">/ system backup load name=mikrotik-20120130
</pre>
If neeeded, you can reset the router before restoring the backup.<br />
Another option is to <strong>export/import</strong> several parts (or the whole) of the router configuration. Its format is text, in the for of the commands that are needed to accomplish the configuration.<br />
Referencies:<br />
<ul>
<li><a _mce_href="http://wiki.mikrotik.com/wiki/Manual:Configuration_Management" href="http://wiki.mikrotik.com/wiki/Manual:Configuration_Management">http://wiki.mikrotik.com/wiki/Manual:Configuration\_Management</a></li>
</ul>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-3">
<h2 id="sec-3">
<span class="section-number-2">3</span>. How to correct the date and time</h2>
<div class="outline-text-2" id="text-3">
The MikroTik router does not have an internal clock. So, after it is rebooted, it has no idea of what time is it. It has to get the correct time from internet, using the NTP protocol.<br />
The commands look like these:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">/ system clock print
/ system clock set date=jan/30/2012 time=9:45:00 time-zone-name=Europe/Tirane
/ system ntp client print
/ system ntp client set enabled=yes mode=unicast \
primary-ntp=130.88.200.4 secondary-ntp=129.6.15.28
</pre>
Referencies:<br />
<ul>
<li><a _mce_href="http://wiki.mikrotik.com/wiki/Manual:System/Time" href="http://wiki.mikrotik.com/wiki/Manual:System/Time">http://wiki.mikrotik.com/wiki/Manual:System/Time</a></li>
<li><a _mce_href="http://www.mikrotik.com/testdocs/ros/2.9/system/ntp.php" href="http://www.mikrotik.com/testdocs/ros/2.9/system/ntp.php">http://www.mikrotik.com/testdocs/ros/2.9/system/ntp.php</a></li>
<li><a _mce_href="http://tf.nist.gov/tf-cgi/servers.cgi" href="http://tf.nist.gov/tf-cgi/servers.cgi">http://tf.nist.gov/tf-cgi/servers.cgi</a></li>
<li><a _mce_href="http://community.plus.net/forum/index.php?topic=5679.msg46179" href="http://community.plus.net/forum/index.php?topic=5679.msg46179">http://community.plus.net/forum/index.php?topic=5679.msg46179</a></li>
</ul>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-4">
<h2 id="sec-4">
<span class="section-number-2">4</span>. How to add DNAT rules</h2>
<div class="outline-text-2" id="text-4">
If we want to forward ports 80 and 443 (HTTP and HTTPS) to a local webserver (with IP, say<code>192.168.10.46</code>), we can do it like this:<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">/ip firewall nat add chain=dstnat \
dst-address=109.69.41.70 protocol=tcp dst-port=80 \
action=dst-nat to-addresses=192.168.10.46 to-ports=80
/ip firewall nat add chain=dstnat \
dst-address=109.69.41.70 protocol=tcp dst-port=443 \
action=dst-nat to-addresses=192.168.10.46 to-ports=443
</pre>
</div>
</div>
<div _mce_style="color: #000000; font-family: Times, serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;" class="outline-2" id="outline-container-5">
<h2 id="sec-5">
<span class="section-number-2">5</span>. Set up packet filtering</h2>
<div class="outline-text-2" id="text-5">
These are some example commands that I could find in internet, about hardening the firewall of MikroTik. I don't understand all of them, but I don't have to. They don't need to be customized and can be applied simply with copy/paste.<br />
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">/ ip firewall filter
add chain=input connection-state=established comment="Accept established connections"
add chain=input connection-state=related comment="Accept related connections"
add chain=input connection-state=invalid action=drop comment="Drop invalid connections"
add chain=input protocol=udp action=accept comment="UDP" disabled=no
add chain=input protocol=icmp limit=50/5s,2 comment="Allow limited pings"
add chain=input protocol=icmp action=drop comment="Drop excess pings"
add chain=input src-address=192.168.1.0/24 comment="From our private LAN"
add chain=input protocol=tcp dst-port=22 src-address=192.168.1.0/24 comment="SSH for secure shell"
add chain=input protocol=tcp dst-port=8291 src-address=192.168.1.0/24 comment="winbox"
add chain=input action=log log-prefix="DROP INPUT" comment="Log everything else"
add chain=input action=drop comment="Drop everything else"
</pre>
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">add chain=forward protocol=udp dst-port=69 action=drop comment="Blocking UDP Packets"
add chain=forward protocol=udp dst-port=111 action=drop
add chain=forward protocol=udp dst-port=135 action=drop
add chain=forward protocol=udp dst-port=137-139 action=drop
add chain=forward protocol=udp dst-port=2049 action=drop
add chain=forward protocol=udp dst-port=3133 action=drop
add chain=forward protocol=tcp dst-port=69 action=drop comment="Blocking TCP Packets"
add chain=forward protocol=tcp dst-port=111 action=drop
add chain=forward protocol=tcp dst-port=119 action=drop
add chain=forward protocol=tcp dst-port=135 action=drop
add chain=forward protocol=tcp dst-port=137-139 action=drop
add chain=forward protocol=tcp dst-port=445 action=drop
add chain=forward protocol=tcp dst-port=2049 action=drop
add chain=forward protocol=tcp dst-port=12345-12346 action=drop
add chain=forward protocol=tcp dst-port=20034 action=drop
add chain=forward protocol=tcp dst-port=3133 action=drop
add chain=forward protocol=tcp dst-port=67-68 action=drop
</pre>
<pre _mce_style="border: 1pt solid #aebdcc; background-color: #f3f5f7; padding: 5pt; font-family: courier, monospace; font-size: 14px; overflow: auto;" class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; margin-top: 8px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">/ip firewall filter print stats
/ip firewall filter reset-counters-all
/log print
/log print follow</pre>
</div>
</div>
<br />
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-38929336763639839832012-08-09T02:49:00.002+02:002012-08-09T02:49:41.437+02:00How to Create a Local Ubuntu Repository<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: left;">
<span style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">We have about 40 computers installed with Edubuntu, and more than a dozen of servers (most of them running on virtual machines). They all need to be updated time after time with the latest version of packages. Also, time after time, new packages need to be installed. These packages come from some central Ubuntu Repository servers.</span></div>
<div style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
All this activity for keeping computers up-to-date (up to the latest version) consumes lots of bandwidth and takes a lot of time. And there are new package updates almost every day! For one computer this can be acceptable, however for lots of computers it may become unbearable.</div>
<div style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
One solution for this problem is to create a local mirror of the ubuntu repository.</div>
<a name='more'></a><br />
<div id="table-of-contents" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2>
Table of Contents</h2>
<div id="text-table-of-contents">
<ol style="text-align: left;">
<li>Creating an APT Mirror</li>
<li>Configure clients for using the local repository</li>
<li>Keeping the APT mirror synchronized</li>
<li>Doing release upgrade from our local ubuntu repository</li>
<li>Referencies:</li>
</ol>
</div>
</div>
<div class="outline-2" id="outline-container-1" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2 style="text-align: left;">
<span class="section-number-2">1</span> Creating an APT Mirror</h2>
<div class="outline-text-2" id="text-1">
Fortunately, creating a local mirror of the APT packages is very easy. There is even a tool that helps to create it, called <code>apt-mirror</code>. So, the first step is to install it:<br />
<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">aptitude install apt-mirror
</pre>
The next step is to customize its configuration file, <code>/etc/apt/mirror.list</code>. It should look like this:<br />
<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">set base_path /data/apt-mirror
set defaultarch amd64
set nthreads 5
deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-proposed main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
deb-i386 http://archive.ubuntu.com/ubuntu precise-proposed main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu precise partner
deb http://extras.ubuntu.com/ubuntu precise main
deb-i386 http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb-i386 http://archive.canonical.com/ubuntu precise partner
deb-i386 http://extras.ubuntu.com/ubuntu precise main
deb http://dl.google.com/linux/chrome/deb/ stable main
deb http://packages.medibuntu.org/ precise free non-free
deb http://ppa.launchpad.net/epoptes/ppa/ubuntu precise main
deb http://ppa.launchpad.net/loneowais/gmailwatcher.dev/ubuntu precise main
deb http://ppa.launchpad.net/webupd8team/gnome3/ubuntu precise main
deb-i386 http://packages.medibuntu.org/ precise free non-free
deb-i386 http://ppa.launchpad.net/epoptes/ppa/ubuntu precise main
deb-i386 http://ppa.launchpad.net/loneowais/gmailwatcher.dev/ubuntu precise main
deb-i386 http://ppa.launchpad.net/webupd8team/gnome3/ubuntu precise main
#deb-src http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
#deb-src http://archive.canonical.com/ubuntu precise partner
#deb-src http://extras.ubuntu.com/ubuntu precise main
#deb-src http://archive.canoniccom/ubuntu precise partner
clean http://archive.ubuntu.com/ubuntu
</pre>
The URL-s here are the same to what I have on <code>/etc/apt/sources.list</code> on my computers. I am storing the packages on the directory<code>/data/apt-mirror</code>, which has plenty of free disk space (at least 200 GB). I am mirroring the packages for both <b>amd64</b> and <b>i386</b> architectures, and i am skipping the source packages (<b>deb-src</b>) to save some space.<br />
Now we can start making the mirror (or updating it) by running <code>apt-mirror</code>.<br />
<dl>
<dt style="font-weight: bold;">Note</dt>
<dd>If the mirroring process is interrupted, start it again by typing <code>apt-mirror</code>. If it refuses to start (claiming that it is already running), look out for<code>/data/apt-mirror/var/apt-mirror.lock</code> and remove it.</dd>
<dt style="font-weight: bold;">Note</dt>
<dd>Initially it can take a lot of time (several days) to make a full mirror, depending on the speed of the network connection.</dd></dl>
After mirroring is done, we can export the mirror by HTTP:<br />
<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">ln -s /data/apt-mirror/mirror /var/www/apt-mirror
</pre>
Of course, <i>apache</i> has to be already installed (<code>aptitude install apache2</code>).</div>
</div>
<div class="outline-2" id="outline-container-2" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2 id="sec-2">
<span class="section-number-2">2</span> Configure clients for using the local repository</h2>
<div class="outline-text-2" id="text-2">
In order to use this mirror from a client, modify <code>/etc/apt/sources.list</code> to use something like this <code>http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/</code> instead of <code>http://archive.ubuntu.com/ubuntu/</code>. It should look like this:<br />
<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise main restricted
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise main restricted
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates main restricted
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise universe
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise universe
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates universe
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise multiverse
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise multiverse
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates multiverse
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
# deb-src http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security main restricted
# deb-src http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security main restricted
deb http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security universe
# deb-src http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security universe
deb http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security multiverse
# deb-src http://192.168.10.50/apt-mirror/security.ubuntu.com/ubuntu precise-security multiverse
deb http://192.168.10.50/apt-mirror/extras.ubuntu.com/ubuntu precise main
# deb-src http://192.168.10.50/apt-mirror/extras.ubuntu.com/ubuntu precise main
deb http://192.168.10.50/apt-mirror/dl.google.com/linux/chrome/deb/ stable main
## Please report any bug on https://bugs.launchpad.net/medibuntu/
deb http://192.168.10.50/apt-mirror/packages.medibuntu.org/ precise free non-free #Medibuntu - Ubuntu 11.10 "precise ocelot"
# deb-src http://packages.medibuntu.org/ precise free non-free #Medibuntu (source) - Ubuntu 11.10 "precise ocelot"
deb http://192.168.10.50/apt-mirror/archive.canonical.com/ubuntu precise partner #Added by software-center
</pre>
Here, <code>192.168.10.50</code> is the IP of the server where we have created the mirror.</div>
</div>
<div class="outline-2" id="outline-container-3" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2 id="sec-3">
<span class="section-number-2">3</span> Keeping the APT mirror synchronized</h2>
<div class="outline-text-2" id="text-3">
To synchronize our local repository with the central one, we can just run <code>apt-mirror</code> at any time. However I usually prefer to automate things, so I have created the script <code>/etc/cron.daily/aptmirror</code>:<br />
<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">#!/bin/sh
rm /data/apt-mirror/var/apt-mirror.lock
/usr/bin/apt-mirror
/data/apt-mirror/var/clean.sh
</pre>
This will run automatically each day (during the night). Make sure that it is executable: <code>chmod +x /etc/cron.daily/aptmirror</code> .</div>
</div>
<div class="outline-2" id="outline-container-4" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2 id="sec-4">
<span class="section-number-2">4</span> Doing release upgrade from our local ubuntu repository</h2>
<div class="outline-text-2" id="text-4">
Once in a while (once in 6 months or so), Ubuntu makes new releases. It would be usefull if we can upgrade from our local APT mirror. However this needs some further steps to be taken.<br />
<ul>
<li>First of all, get a local copy of <i>dist-upgrader</i> files:<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">cd /data/apt-mirror/mirror
mkdir dist_upgrade
cd dist_upgrade
export dist_upgrader_url='http://archive.ubuntu.com/ubuntu/dists/precise/main/dist-upgrader-all/current'
wget $dist_upgrader_url/precise.tar.gz
wget $dist_upgrader_url/precise.tar.gz.gpg
wget $dist_upgrader_url/ReleaseAnnouncement
wget $dist_upgrader_url/ReleaseAnnouncement.html
</pre>
</li>
<li>Get a local copy of the files <i>meta-release</i> and <i>meta-release-lts</i> as well:<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">cd /data/apt-mirror/mirror/dist_upgrade/
wget http://changelogs.ubuntu.com/meta-release
wget http://changelogs.ubuntu.com/meta-release-lts
</pre>
</li>
<li>Modify the URL-s in the file <i>meta-release</i> to look like this:<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">Dist: oneiric
Name: Oneiric Ocelot
Version: 11.10
Date: Thu, 13 Oct 2011 12:00:00 UTC
Supported: 1
Description: This is the 11.10 release
Release-File: http://archive.ubuntu.com/ubuntu/dists/oneiric/Release
ReleaseNotes: http://archive.ubuntu.com/ubuntu/dists/oneiric-updates/main/dist-upgrader-all/current/ReleaseAnnouncement
ReleaseNotesHtml: http://archive.ubuntu.com/ubuntu/dists/oneiric-updates/main/dist-upgrader-all/current/ReleaseAnnouncement.html
UpgradeTool: http://archive.ubuntu.com/ubuntu/dists/oneiric-updates/main/dist-upgrader-all/current/oneiric.tar.gz
UpgradeToolSignature: http://archive.ubuntu.com/ubuntu/dists/oneiric-updates/main/dist-upgrader-all/current/oneiric.tar.gz.gpg
Dist: precise
Name: Precise Pangolin
Version: 12.04 LTS
Date: Thu, 26 Apr 2012 12:04:00 UTC
Supported: 1
Description: This is the 12.04 LTS release
Release-File: http://192.168.10.50/apt-mirror/archive.ubuntu.com/ubuntu/dists/precise/Release
ReleaseNotes: http://192.168.10.50/apt-mirror/dist_upgrade/ReleaseAnnouncement
ReleaseNotesHtml: http://192.168.10.50/apt-mirror/dist_upgrade/ReleaseAnnouncement.html
UpgradeTool: http://192.168.10.50/apt-mirror/dist_upgrade/precise.tar.gz
UpgradeToolSignature: http://192.168.10.50/apt-mirror/dist_upgrade/precise.tar.gz.gpg
</pre>
Do the same for the file <i>meta-release-lts</i>.</li>
<li>On each system that is to be upgraded install <i>update-manager-core</i>:<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;">aptitude install update-manager-core
</pre>
</li>
<li>On each system that is to be upgraded modify the URL-s in the file <code>/etc/update-manager/meta-release</code> to look like this:<pre class="example" style="background-color: #f3f5f7; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; font-family: courier, monospace; font-size: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt;"># default location for the meta-release file
[METARELEASE]
URI = http://192.168.10.50/apt-mirror/dist_upgrade/meta-release
URI_LTS = http://192.168.10.50/apt-mirror/dist_upgrade/meta-release-lts
URI_UNSTABLE_POSTFIX = -development
URI_PROPOSED_POSTFIX = -proposed
</pre>
</li>
<li>Run <code>do-release-upgrade</code> on the systems that should be upgraded. Now everything should be retrieved from the local mirror, without going out to the Internet.</li>
<li><b>Note</b>: Make sure to comment out all lines starting with <b>deb-src</b> on <code>/etc/apt/sources.list</code> before starting the upgrade, since we have not retrieved the source packages in our local mirror.</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-5" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<h2 id="sec-5">
<span class="section-number-2">5</span> Referencies:</h2>
<div class="outline-text-2" id="text-5">
<ul>
<li><a href="http://www.supportsages.com/blog/2010/05/how-to-create-a-local-ubuntu-repository-updateupgrade-distros-locally-and-thereby-save-bandwidth/">http://www.supportsages.com/blog/2010/05/how-to-create-a-local-ubuntu-repository-updateupgrade-distros-locally-and-thereby-save-bandwidth/</a></li>
<li><a href="http://blog.knuthaugen.no/2009/12/doing-do-release-upgrade-on-an-offline-ubuntu-mirror.html">http://blog.knuthaugen.no/2009/12/doing-do-release-upgrade-on-an-offline-ubuntu-mirror.html</a></li>
</ul>
</div>
</div>
<div id="postamble" style="font-family: Times, serif; font-size: 16px; text-align: -webkit-auto;">
<div class="author">
<br /></div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-45707197512400814272012-08-09T02:38:00.001+02:002012-08-23T23:13:58.960+02:00Computer LAB Management<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="posterous_autopost">
<div style="font-family: Times, serif; font-size: 16px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
We have two labs with 16 computers each. In each computer we have installed the latest version of <a _mce_href="http://edubuntu.org/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://edubuntu.org/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">Edubuntu</a> (Linux) with almost the same configuration (partitions, installed packages, etc.). It is a bit of hard work to manage all of them one by one, so we have tried to find workarounds to manage all of them at once. There are different ways and solutions to accomplish this in Linux, but we have adopted a simple and practical one, suitable for our case.</div>
<a name='more'></a><br /><br />
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" id="table-of-contents" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Table of Contents</h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" id="text-table-of-contents" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<ol>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Setting a static IP to each computer</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Managing computers remotely</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Administrating multiple computers at once</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Getting the mac addresses</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Turning on all the computers remotely</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Turning OFF all the computers remotely</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Adding an administrator user</span></li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="color: #ff1111;" style="color: #ff1111;">Remove autologin</span></li>
</ol>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">1. Setting a static IP to each computer</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
First of all, it is better to set a static IP to each computer, instead of letting them to get a dynamic (random) IP by DHCP. This is required for accessing and managing them remotely. It can be done like this:</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">First of all disable/remove the <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">network-manager</code> service, because it will try to configure automatically the network interface:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">apt-get purge network-manager
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Then edit <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/network/interfaces</code> like this:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.51
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 80.78.66.66 80.78.66.67
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Finally, restart the networking:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">sudo /etc/init.d/networking restart
</pre>
</li>
</ul>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Note:</strong> It is even better if we configure the DHCP server to give always the same IP to the same computer, based on the MAC of its network interface. However the method above is quite ok.</div>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">2. Managing computers remotely</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
In order to run commands remotely through <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">ssh</strong>, without entering a password, we can generate a public-private key pair, and then put the public key on each computer.</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Generate a public/private key pair:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">sudo su
ssh-keygen
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Transfer the public key to each PC and append it to <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/root/.ssh/authorized_keys</code>:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">scp id_rsa.pub
<a _mce_href="mailto:root@192.168.1.51" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:root@192.168.1.51" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">root@192.168.1.51</a>:
ssh
<a _mce_href="mailto:root@192.168.1.51" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:root@192.168.1.51" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">root@192.168.1.51</a>
mkdir .ssh
chmod 700 .ssh
cat id_rsa.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
rm id_rsa.pub
exit
</pre>
</li>
</ul>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Now we can run without password commands like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">ssh 192.168.1.51 ls -al
ssh 192.168.1.51 apt-get update
ssh 192.168.1.51 apt-get upgrade
etc.
</pre>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">3. Administrating multiple computers at once</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">First install the package <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">mssh</strong> (Multi-SSH):<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">sudo apt-get install mssh
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Now we can run the same commands on many computers, like this:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">mssh 192.168.1.51 192.168.1.52 192.168.1.53
mssh 192.168.1.5{1,2,3,4,5,6,7,8,9}
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">However, for convenience we can put all the IPs in a file like <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">iplist_lab1.txt</code>, which looks like this:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">192.168.1.51
192.168.1.52
192.168.1.53
192.168.1.54
192.168.1.55
. . . . .
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Now we can run the command <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">mssh</strong> with all of them, with a command like this:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">mssh $(cat iplist_lab1.txt)
or
mssh $(<iplist_lab1.txt)
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-4" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-4" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">4. Getting the mac addresses</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-4" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
We need the MAC addresses of each PC in order to turn them ON remotely, from the LAN. We may also need them later to set up the DHCP server so that each computer gets a fixed IP.</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
In order to get them remotely, first we ping each IP, then we get the neighbor list with <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">ip neigh</code>, and finally we process it to get a clean list:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">for IP in $(cat iplist_lab1.txt); do ping -c 2 $IP; done
ip neigh > mac_list.txt
gawk '{print $1 " " $5}' mac_list.txt > mac_list_1.txt
sort mac_list_1.txt > mac_list_lab1.txt
rm mac_list_1.txt
</pre>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
The final list <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">mac_list_lab1.txt</code> should be something like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">192.168.1.51 2c:41:38:a9:82:ef
192.168.1.52 2c:41:38:a9:82:7c
192.168.1.53 2c:41:38:a5:94:f2
192.168.1.54 2c:41:38:a5:94:d7
192.168.1.55 2c:41:38:a5:98:66
. . . . .
</pre>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-5" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-5" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">5. Turning on all the computers remotely</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-5" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Almost all of the computers nowadays support a feature called <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Wake-On-LAN</strong> (or <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">WOL</strong>). It can be used to turn on a PC from the LAN by sending it a special packet. Let's see how we can use it.</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">First of all make sure that it is enabled on the BIOS Setup.</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Then install the package <strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">wakeonlan</strong>:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">sudo apt-get install wakeonlan
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Then get a list of MAC addresses and IPs of all the computers. It can be generated by rearranging the columns on<code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">mac_list_lab1.txt</code>:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">gawk '{print $2 " " $1}' mac_list_lab1.txt > lab1.wol
</pre>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
The file <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">lab1.wol</code> looks like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">2c:41:38:a9:82:ef 192.168.1.51
2c:41:38:a9:82:7c 192.168.1.52
2c:41:38:a5:94:f2 192.168.1.53
2c:41:38:a5:94:d7 192.168.1.54
2c:41:38:a5:98:66 192.168.1.55
. . . . .
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Then, to turn ON all the computers on LAB1, run the command <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">wakeonlan</code> with this list as a parameter:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">wakeonlan -f lab1.wol
</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-6" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-6" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">6. Turning OFF all the computers remotely</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-6" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
A PC can be turned OFF using the command <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">poweoff</code> remotely, like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">sudo su
for IP in $(<iplist_lab1.txt); do echo --$IP; ssh $IP poweroff; done
</pre>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Here, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">iplist_lab1.txt</code> is a list with IP-s of all the PC-s, like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">192.168.1.51
192.168.1.52
192.168.1.53
192.168.1.54
192.168.1.55
. . . . .
</pre>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-7" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-7" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">7. Adding an administrator user</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-7" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
The computers in LAB1 initially were installed with user <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">student</em> as administrative user. These steps show how to add another administrative user and how to remove the administrative privileges from the user <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">student</em>.</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Create user administrator:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">adduser administrator
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Add this user to groups:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">adduser administrator adm
adduser administrator dialout
adduser administrator cdrom
adduser administrator plugdev
adduser administrator lpadmin
adduser administrator admin
adduser administrator sudo
</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Remove the user student from privileged groups:<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f3f5f7; font-family: courier, monospace; color: #000022; line-height: 1.2; overflow-x: auto; overflow-y: auto; padding: 5pt; border: 1pt solid #aebdcc;" class="example" style="background-attachment: initial; background-clip: initial; background-color: #f3f5f7; background-image: initial; background-origin: initial; border-bottom-color: rgb(174, 189, 204); border-bottom-style: solid; border-bottom-width: 1pt; border-image: initial; border-left-color: rgb(174, 189, 204); border-left-style: solid; border-left-width: 1pt; border-right-color: rgb(174, 189, 204); border-right-style: solid; border-right-width: 1pt; border-top-color: rgb(174, 189, 204); border-top-style: solid; border-top-width: 1pt; color: #000022; font-family: courier, monospace; font-size: 14px; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5pt; padding-left: 5pt; padding-right: 5pt; padding-top: 5pt; vertical-align: baseline;">deluser student adm
deluser student admin
deluser student sudo</pre>
</li>
</ul>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Times, serif; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-2" id="outline-container-8" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h4 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1.5em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1.25; background-position: initial initial; background-repeat: initial initial; padding: 0px; border: 0px initial initial;" id="sec-8" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-size: 1.5em; line-height: 1.25; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="section-number-2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">8. Remove autologin</span></h4>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" class="outline-text-2" id="text-8" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
The initial configuration of the computers in LAB1 was to autologin to user <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">student</em>. In order to remove the autologin, edit<code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/lightdm/lightdm.conf</code> and leave empty <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">autologin-user=</code></div>
<div>
<code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;"><br /></code></div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0tag:blogger.com,1999:blog-5945244389322428562.post-17286390433188764252012-08-09T02:36:00.001+02:002012-08-23T23:10:22.760+02:00Multiple Webservers Behind NAT<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="posterous_autopost">
<div style="color: #555555; font-family: Georgia, Times New Roman, Times, serif; font-size: 12px; line-height: 19px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;">
</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
The problem is that we have got from the ISP a single public IP, and we need to host our own public webservers (more than one) in our LAN. How to do this?</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
The first thing to be done is to use <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">port forwarding</em> (also called Destination NAT or DNAT) to forward the tcp ports 80 and 443 from the gateway (MikroTik in out case) to an internal webserver on our LAN. Then we could use the <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">name-based virtual hosting</em> of apache2 to host several domains/subdomains on the same webserver and everything would be fine.</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; margin: 0px; border: 0px initial initial;" id="text-1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
However the issue is a little bit more complicated than this, because sometimes it is not possible (or suitable, or convenient) to host two different websites on the same server. For example our website is built on Joomla, and it has some modules that do not work well with the latest version of PHP (5.3), and it depends on PHP-5.2. Also, sometimes it can be suitable/convenient to use appliancies from TurnKey Linux (<a _mce_href="http://www.turnkeylinux.org/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.turnkeylinux.org/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"></a><a _mce_href="http://www.turnkeylinux.org/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.turnkeylinux.org/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">http://www.turnkeylinux.org/</a>), for easy installation and maintenance, but they need to have their own server. What to do in this case?</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
In this case, the <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Reverse Proxy</em> module of apache2 comes to rescue. The idea is that the main webserver forwards the http requests to the other webservers, behaving like a kind of http gateway or hub.</div>
<a name='more'></a><br /><br />
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Let's see how to do the configuration. Suppose that we have the subdomains<em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffcc; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-color: #ffffcc; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><span _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #333333; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #333333; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"> www.cit.edu.al</span></em>, <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffcc; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-color: #ffffcc; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">www-test.cit.edu.al</em>, <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffcc; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-color: #ffffcc; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">moodle.cit.edu.al</em> and <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #ffffcc; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-color: #ffffcc; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">ocw.cit.edu.al</em>. The first two domains will be hosted on the same webserver, and moodle and ocw will have their own webserver each.</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; margin: 0px; border: 0px initial initial;" id="outline-container-1.1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h3 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 2em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-weight: normal; line-height: 1; padding: 0px; border: 0px initial initial;" class="western" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-size: 2em; font-weight: normal; line-height: 1; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
1. DNS configurations</h3>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" id="text-1.1" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines on <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/var/cache/bind/db.cit.edu.al</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">www IN A 109.69.4.170
www-test IN A 109.69.4.170
moodle IN CNAME www
ocw IN CNAME www</pre>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Don't forget to modify the serial number, and then restart the service with <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">service bind9 restart</code>.</div>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; margin: 0px; border: 0px initial initial;" id="outline-container-1.2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h3 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 2em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-weight: normal; line-height: 1; padding: 0px; border: 0px initial initial;" class="western" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-size: 2em; font-weight: normal; line-height: 1; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
2. Gateway (MikroTik) configurations</h3>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" id="text-1.2" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these firewall rules from the terminal (or from winbox):</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">ip firewall nat chain=dstnat action=dst-nat to-addresses=192.168.10.46 to-ports=80 protocol=tcp dst-address=109.69.4.170 dst-port=80
ip firewall nat chain=dstnat action=dst-nat to-addresses=192.168.10.46 to-ports=443 protocol=tcp dst-address=109.69.4.170 dst-port=443 </pre>
</div>
</div>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; margin: 0px; border: 0px initial initial;" id="outline-container-1.3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<h3 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 2em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #444444; font-weight: normal; line-height: 1; padding: 0px; border: 0px initial initial;" class="western" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-size: 2em; font-weight: normal; line-height: 1; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
3. Configurations on the main webserver</h3>
<div _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" id="text-1.3" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
On the gateway webserver (192.168.10.46) do these apache configurations:</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable SSL Name-Based virtual hosting.</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable mode <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">ssl</em>: <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">a2enmod ssl</code></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Edit <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/apache2/ports.conf</code> and add the line <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">NameVirtualHost *:443</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
NameVirtualHost *:443
Listen 443
</IfModule></pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Edit <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/apache2/sites-available/default-ssl</code> and change the VirtualHost statement (at the top) to <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;"><VirtualHost *:443></code>, like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><IfModule mod_ssl.c>
<VirtualHost *:443></pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Then restart apache: <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">service apache2 restart</code></div>
</li>
</ul>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable the proxy modules etc.:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">a2enmod proxy
a2enmod proxy_http
a2enmod proxy_connect
a2enmod proxy_balancer
a2enmod headers
a2enmod cache
a2enmod mem_cache </pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
On the directory <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/apache2/sites-available</code>, copy files <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">default</code> and <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">default-ssl</code> to<code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test-ssl</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">moodle</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">moodle-ssl</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">ocw</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">ocw-ssl</code>, etc. Then modify these files similarly to <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code> and <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code> below:</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><VirtualHost *:80>
ServerName www.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
ProxyRequests off
ProxyPass / http://www.cit.edu.al/
ProxyPassReverse / http://www.cit.edu.al/</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
ProxyRequests off
SSLProxyEngine on
ProxyPass / https://www.cit.edu.al/
ProxyPassReverse / https://www.cit.edu.al/</pre>
</li>
</ul>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable the sites <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>, etc. like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">a2ensite cit
a2ensite cit-ssl
a2ensite cit-test
a2ensite cit-test-ssl
a2ensite moodle
a2ensite moodle-ssl
a2ensite ocw
a2ensite ocw-ssl</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Restart or reload apache2: <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">service apache2 reload</code></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<strong _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">Important!</strong> Modify the file <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/hosts</code> and append these lines:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">192.168.10.52 www.cit.edu.al
192.168.10.52 www-test.cit.edu.al
192.168.10.53 moodle.cit.edu.al
192.168.10.54 ocw.cit.edu.al</pre>
</li>
</ul>
</div>
</div>
<h3 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 2em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1; padding: 0px; border: 0px initial initial;" class="western" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-size: 2em; font-weight: normal; line-height: 1; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
4. Configurations on the webservers that are accessed through the proxy</h3>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
On the webserver <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">192.168.10.52</code> (that is hosting the websites <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">www.cit.edu.al</em> and <em _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">www-test.cit.edu.al</em>), make these configurations:</div>
<ul style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal; text-align: -webkit-auto;">
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable SSL Name-Based virtual hosting (as described previously).</div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Place the files of the websites on the directories <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/var/www/cit/</code> and <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/var/www/cit-test/</code>.</div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
On the directory <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">/etc/apache2/sites-available</code>, copy files <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">default</code> and <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">default-ssl</code> to<code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test-ssl</code>, and modify these files like this:</div>
<ul>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><VirtualHost *:80>
ServerName www.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
DocumentRoot /var/www/cit
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/cit/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory></pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
DocumentRoot /var/www/cit
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/cit/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory></pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><VirtualHost *:80>
ServerName www-test.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
DocumentRoot /var/www/cit-test
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/cit-test/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory></pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Add these lines at the top of <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test-ssl</code>:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;"><IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www-test.cit.edu.al
ServerAdmin
<a _mce_href="mailto:admin@cit.edu.al" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="mailto:admin@cit.edu.al" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">admin@cit.edu.al</a>
DocumentRoot /var/www/cit-test
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/cit-test/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory></pre>
</li>
</ul>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Enable the sites <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-ssl</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test</code>, <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">cit-test-ssl</code> etc. like this:</div>
<pre _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 10px; border-style: solid; border-color: #cccccc; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 10px;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 10px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 1.5em; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; vertical-align: baseline;">a2ensite cit
a2ensite cit-ssl
a2ensite cit-test
a2ensite cit-test-ssl</pre>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
Restart or reload apache2: <code _mce_style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #f9f9f9; white-space: pre; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; color: #000022; line-height: 1.2; padding: 3px; border: initial none initial;" class="western" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; border-image: initial; color: #000022; font-family: monospace, 'andale mono', 'monotype.com', 'lucida console'; font-size: 1em; line-height: 1.2; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 3px; padding-left: 3px; padding-right: 3px; padding-top: 3px; vertical-align: baseline; white-space: pre;">service apache2 reload</code></div>
</li>
</ul>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
Do the same thing for the other webservers as well.</div>
<div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #555555; font-family: Georgia, 'Times New Roman', Times, serif; line-height: 19px; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
<br /></div>
<h3 _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 2em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; color: #444444; font-family: Georgia, 'Times New Roman', Times, serif; font-weight: normal; line-height: 1; padding: 0px; border: 0px initial initial;" class="western" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #444444; font-size: 2em; font-weight: normal; line-height: 1; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: -webkit-auto; vertical-align: baseline;">
5. Referencies</h3>
<ul style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: normal; text-align: -webkit-auto;">
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<a _mce_href="http://fob.po8.org/node/289" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://fob.po8.org/node/289" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"></a><a _mce_href="http://fob.po8.org/node/289" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://fob.po8.org/node/289" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">http://fob.po8.org/node/289</a></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<a _mce_href="http://www.askapache.com/hosting/reverse-proxy-apache.html" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.askapache.com/hosting/reverse-proxy-apache.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"></a><a _mce_href="http://www.askapache.com/hosting/reverse-proxy-apache.html" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.askapache.com/hosting/reverse-proxy-apache.html" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">http://www.askapache.com/hosting/reverse-proxy-apache.html</a></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<a _mce_href="http://blogs.adobe.com/cguerrero/2010/10/27/configuring-a-reverse-proxy-with-apache-that-handles-https-connections/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://blogs.adobe.com/cguerrero/2010/10/27/configuring-a-reverse-proxy-with-apache-that-handles-https-connections/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"></a><a _mce_href="http://blogs.adobe.com/cguerrero/2010/10/27/configuring-a-reverse-proxy-with-apache-that-handles-https-connections/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://blogs.adobe.com/cguerrero/2010/10/27/configuring-a-reverse-proxy-with-apache-that-handles-https-connections/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">http://blogs.adobe.com/cguerrero/2010/10/27/configuring-a-reverse-proxy-with-apache-that-handles-https-connections/</a></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 0in; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0in; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<a _mce_href="http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"></a><a _mce_href="http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; text-decoration: none; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;">http://blog.lundscape.com/2009/05/configure-a-reverse-proxy-with-apache/</a></div>
</li>
<li _mce_style="border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; margin: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"><div _mce_style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; border-image: initial; outline-width: 0px; outline-style: initial; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; padding: 0px; border: 0px initial initial;" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; margin-bottom: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">
<a _mce_href="http://www.raskas.be/blog/2006/04/21/reverse-proxy-of-virtual-hosts-with-apache-2/" _mce_style="border-image: initial; outline-width: initial; outline-style: none; outline-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #ff1111; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.raskas.be/blog/2006/04/21/reverse-proxy-of-virtual-hosts-with-apache-2/" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-image: initial; color: #ff1111; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;">http://www.raskas.be/blog/2006/04/21/reverse-proxy-of-virtual-hosts-with-apache-2/</a></div>
<div>
<br /></div>
</li>
</ul>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/16053462159518112324noreply@blogger.com0