Spiga

‘ Linux ’ category archive

Replication / Mirroring as Master-master with Subversion using svnsync

June 26, 09 by Gabi Solomon

For me it all started when my VPS had an error and all my SVN repos were lost. Plus even though i had purchased a backup system from the hosting company that was suppose to do a full server backup automatic and incrementally, i only had a backup from 20 days earlier because the system failed at that point in time and didnt run since.

But enough with my problems, at that point i decided to make a copy of my repos from the remote server to my local machine.
And i would commit into the local one and it should automaticly sync to the remote one. Plus it would need to do this both ways and in real time since i had some external people commiting in the remote server. Easier said then done i camed to find out.

The reasons why

Well for me there are 3 main reasons:
1. as a backup system ( dont want to be put in the 20 days old backup situation again )
2. for faster commits and updates
3. independent of the internet connection ( it hasnt failed in quite a while, but just in case, or for the times its a bit slow )

The alternatives

It seems that this topic is a bit popular, and there are a few places on the internet where people are interested in this. You can check out this question on stackoverflow for one.

1. Git-SVN
This is one alternative that a lot of people have been recommended. The benefits they are you get the best out of both worlds, you can still use the Subversion in the main repo, but you get the power of GIT for your local copy.
Although this sounds very cool, i am more of a GUI guy and really enjoy the subversion integration in my IDE ( Netbeans ) so i would have to pass this options.

2. SVK

svk is a decentralized version control system built with the robust Subversion filesystem. It supports repository mirroring, disconnected operation, history-sensitive merging, and integrates with other version control systems, as well as popular visual merge tools.

At first i read this article about SVK and it seemed to be what i was looking for. But after playing with it for a while i saw that i would need to have a single repo where all my comits would go and that would be synced to several outside repos. But i was looking for a way to have the exact replica of what it is on the remote server so in the case of a failure i could restore them from my backup.

If you are still interested in this you can also read this and this.

3. svnsync + webdav proxy
I knew about svnsync but it only supports read-only copies of your repo. But after reading a small comment on stackoverflow i started looking and find out you can have read-write copies using svnsync and webdav proxy.
What is basicly happening is that your local copy handles the read operations and it forwards the commits to the main repo.

There are a few tricky parts on this solution, that involve the locks and updating of all the replicas of the main repo. This are done by a series of hooks in the main repo.
If youre interested in this solution you can find information about implementing it in this articles:
Subversion transparent proxy with svnsync + webdav proxy
subversion diy write through proxy
Subversion on-the-fly replication

conclusion

Honestly i don’t have one yet :( , but i plant to try using svnsnyc and see how that goes.
I hope you got a big picture of what your options are and now you can decide what suits you best.

Cheers

audit_log_user_command(): Connection refused

by Gabi Solomon

This error happend to me when i runned a command on my Centos VPS.

audit_log_user_command(): Connection refused

And after some googling it seems that a lot of Centos users are running into this when executing SUDO.
But it seens that this is a bug in Centos kernel, and its not fixed yet.
My problem was that i was running the commands logged as root ( silly me ).
Hope you are too, because otherwise i have no sollution for you :( .

Cheers

A TortoiseSVN replacement for Ubuntu

May 12, 09 by Gabi Solomon

I haven’t wrote about this, but i am almost 100% a ubuntu user :D and have been working on ubuntu 8 and now the new 9 version for about 2 months now. And i got to say i am really happy about this move.

But there is one thing i miss from Windows and that is TortoiseSVN, and although i have tried a lot of unix SVN clients none of the seem to really do the trick for me. They all seem to lack some functionality or another.
I know they big boys like to do all from the terminal command, but i am still a bash-fu wannabe so i still use GUI :) .

After a lot of self pity and frustration when i tried to do some SVN operations, and a bit of googling and browsing i stumbled upon Nautilus SVN and i was sold.

NautilusSvn is a Python extension for Nautilus which integrates a load of Subversion functionality into the GNOME Nautilus file manager, basically as a clone of the TortoiseSVN project on Windows.

context_menu

Although still in Beta, it seems to have all the funcionality of TortoiseSVN and a good integration with Nautilus. Haven’t run into any bugs so far, so all is good :D .

Hope you like this as much as i did.
Cheers.

centos apc install error : apxs: command not found

March 03, 09 by Gabi Solomon

I have been trying to install apc for the past 3 hours on my centos VPS and i was getting these error:

Sorry, I was not able to successfully run APXS. Possible reasons:

1. Perl is not installed;
2. Apache was not compiled with DSO support (–enable-module=so);
3. ‘apxs’ is not in your path. Try to use –with-apxs=/path/to/apxs
The output of apxs follows
/root/tmp/pear/APC/configure: line 3263: apxs: command not found
configure: error: Aborting
ERROR: `/root/tmp/pear/APC/configure –with-apxs’ failed

after a alot of searching i finally found the solution. I had to do a manual install.
Asuming you are logged in as root you need to follow the following steps.

1. Grab APC 3.0.8
wget http://pecl.php.net/get/APC-3.0.8.tgz

2.Extract files
gunzip -c APC-3.0.8.tgz

3. change to directory:
cd APC-3.0.8

4. Actual install
phpize
./configure –enable-apc –enable-apc-mmap –with-apxs=/usr/local/apache/bin/apxs –with-php-config=/usr/bin/php-config
make
make install

take note that –with-apxs also specifies the location
As for the rest as the config i am sure you already have opened a ton of pages telling how to do it, if you encountered this error.

Hope you find this page faster then i did.
Cheers

Install Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion

December 29, 08 by Gabi Solomon

Today i finally decided to go ahead with installing subversion, after a bit of reading i opened a ssh session and input :

[root@servername ~]# yum install subversion

But to my surprise i got an error :(

Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion

After a bit of googling i managed to find a solution on a forum and i thought to post it here, maybe other will find it faster :D

First we need to download the perl(URI) with version greater than 1.17 using the following command.

wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm

Then to install the perl package :

rpm -i perl-URI-1.35-3.noarch.rpm

That is it, you can now install and configure subversion as normal.

Cheers.

boxee – the new generation in media centers

August 24, 08 by Gabi Solomon

Just a few minutes ago i happened to tune into Chris Pirillo Ustream Chanel that was showing the GnomeDex conference, and it caught my attention right away.

It was a presentation of a new media center software called boxee.

boxee is a social media center. with boxee you can play videos, music and pictures from your PC or from the Internet. you can also share with your friends what albums you’re listening to, what movies and TV shows you’re watching, send recommendations and more.

boxee is designed to work with a remote control (it looks great on a big screen TV), but you can also control it using your keyboard.

once installed boxee will start scanning your local Movies, Music and Pictures folders automatically. boxee will attempt to bring artwork, reviews, cast, etc. for your media, so browsing your library becomes more useful and fun than looking at a list of files.

boxee is based on the best media center on the planet, xbmc.

If you havent figure it out what the fuss is about, well this media center will drive content right to your screen from services like youtube and last.fm and display it right on your screen, and above all it will let you know your friend activity on those services, get recomandation from your friends on what videos, shows to watch or what music to listen too.

Plus it can connect to other devices on your home network being computers, file storing servers or even mobile devices ( that have a way to comunicate on the network ) and pull in content from them as well : pictures, music or video.

I dont know if this has caught your attention, so i am going to add another BIG + … its OPEN-SOURCE, yes you heard right … open-source, plus it has versions for windows, mac and linux … how cool is that.

The only bad side is its in alpha state and hasnt opened download to everybody, you must register on the site to get a download link ( hope i receive one soon ).

Enjoy the screenshots and videos below.
Cheers.

Custom Error Documents with .htacces

May 24, 08 by Gabi Solomon

Some people only know about .htaccess utility in apache rewrite, but it can do more than that. For example it can help you specify your own Error Documents. When ever a browser makes a request for a web document ( webpage, files, images, css files etc) the server returns a header that contains an error code that tells the browser details about the requests. I will list this codes below:

Successful Client Requests
200 OK
201 Created
202 Accepted
203 Non-Authorative Information
204 No Content
205 Reset Content
206 Partial Content
Client Request Redirected
300 Multiple Choices
301 Moved Permanently
302 Moved Temporarily
303 See Other
304 Not Modified
305 Use Proxy

Client Request Errors
400 Bad Request
401 Authorization Required
402 Payment Required (not used yet)
403 Forbidden
404 Not Found
405 Method Not Allowed
406 Not Acceptable (encoding)
407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type

Server Errors
500 Internal Server Error
501 Not Implemented
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

In order to In order to specify your own ErrorDocuments, you need to know these error codes, since you will need to specify for wich error code you want to assign a page.

But you wont need to specify an error page for all those codes, You only might want to do a custom error page for the most common of them like 404 and 500. Also most people do a custom Error Document for
401 – Authorization Required ( for sections of the site that are protected by a folder password and somebody tries to enter a protected area without corect login details ),
403 – Forbidden ( for example when someone is trying to access a folder withough an index option )
400 – Bad Request, which is one of those generic kind of errors that people get to by doing some weird stuff with your URL or scripts.

The advantage of having custom error documents is that you can display to the user a custom page with the site layout ( instead of the simple default one ) and you can even build a script to make custom logs of this errors.

You shouldn’t make custom pages for all error codes, for example an ErrorDocument for code 200 would cause an infinite loop, whenever a page was found…this would not be good.

To specify your custom error documents, you will add a special command for this in the htaccess file:
ErrorDocument [code] /directory/errorDocument.html

For example an error document for 404 would be:
ErrorDocument 404 /errors/404.html

Now you told the server that when it has an error code of 404 to return the page http://yoursite.com/errors/notfound.html. The same principle apply's to all the codes.

As a small advice i would recommend you make a special folder for your error documents and also name them something that will show theyr error code and purpose. I put 404.html but you can do notFound.html for example. Also the error documents do not need to be html they can also be php,asp or other types of files.

If you dont want to make a special file you can add the html directly in .htaccess file
ErrorDocument 401 "<body> You have to to be a member to view this page.

To do this you need to keep in mind :
the ErrorDocument starts with a " but does not end with one ... that was not a typo :)
the command should be on one line, including the HTML

How to change php configuration on shared servers ?

April 30, 08 by Gabi Solomon

Sometimes your application might require one or more specific php configurations changed from its current value in order to work properly. The most common of this is the requires global_registers flag off ( i have no idea why some servers keep it on ).

If you are talking about a local sever running on your computer or a server to witch you have root rights, the solution is quite simple : you just modify the PHP configuration file (php.ini) to your needs, restart the server … and voila job done.

But what if you are on a shared server. You cant just go and ask the servers support team to modify the configuration for you ( they couldnt even if they wanted to, because that will affect all the websites on there server and then there would be some angry folks on the chat really fast :D ). Luckily the nice folks that designed the software running the server ( apache most of the time ) have thought of you and this situation and added a 2 possibilities for you to change the php configuration only localy without affecting the other websites hosted on the server.

1. Creating a local PHP.ini file

You just create a php.ini file in your domain root and add your configuration as if it was the php.ini from the actual server settings. This will overwrite the settings just for your domain. Getting back to our example where you want to disable register_globals flag off you would add a line to the file like :

“register_globals = off”

2. Using a .htaccess file

The second way would be to use a .htaccess file ( some of you used to do URL rewrite with it ). Now for this you have to know a certain syntax :

# to modify a flag attribute
php_flag [name] [value]

# to modify a value attribute
php_value [name] [value]

Again returning to our example : php_flag register_globals off

To check if your configuration has been changed you can use the phpinfo() function. Your new setting will appear on the local column.
You should know that that not all servers support this methods of modifying the php configuration, some will only support one of them, so you might want to check this would your server support if it doesnt seem to work.

On another note not all php configuration can be changed locally. A full list of php configuration variables can be found on php official website at :

http://www.php.net/manual/en/ini.php#ini.list

The options that can be overwriten localy have the PHP_INI_PERDIR or PHP_INI_ALL Changeable column. The ones with PHP_INI_SYSTEM can only be changed by the php.ini from the php instalation directory.

The first real Linux Contact ( Guide for other Windows Users )

November 18, 07 by Gabi Solomon

Even though i tried to install linux on my laptop several times, and have about 5 linux distribution in my CD colection, i never managed to stay to long in the linux enviroment.

But it seem like the day has come for me to go fearsly into the unknown teritory of Linux. Recently i have received the assignment to build a new network for a Mall to offer them internet service. And since in Romania people are still to to glad to spend money on licence software, we came to the conclusion that the best option was to install a linux OS on all the network computers. This will ensure that the store owners will save quite a few buck with all the software licenses.

So far so good i would say. From here comes the tricky part, i had to find a linux distribution that had to be verry user friendly, since the users would have no knowledge of linux and all cammed from windows, have as much driver suport as possible ( to avoid any hardware recognition problems ) and preferable light weight ( to work OK on oldder desktops and laptops ).

So i took my little knoledge of linux and my trusted friend google and got to work :) . After a few hours of forum and reviews digging, i decided on 4 distribution to test:

1. Linspire

Seemed like a good distribution, and i read good things about it’s ability to make windows user at home with linux. I read a few bad reviews about it that question it’s stability, but the overall opinion was that it is a good distribution for first time windows users. I should mention that the distribution is not free, below there’s a link to buy it from amazon :

I bought the Cd and i can say that indeed for a windows user it’s a real help and will not drive a person away :) . I first install it on my desktop computer and it worked fine, but when i tryed on my laptop as a LiveCD it didnt boot up properly and the looding progress would stop at like 35%. Even if somepersons might comment on my decision, i decided to look for another distribution.

2. Kunbutu 7
As i was browsing the internet in search of a new distribution to try, i cama acroos a forum thread that discused the Linspire distribution, and one of the members was saying that instead of the Linspire Distribution he whould prefer kubuntu that is more stable but also keeps the user friendly look & feel. So i downloaded it in a hurry and decided to give it a try. The instalation went perfectly, and after this i got a warning about my Intel wireless card, that its driver it’s in the ‘restricted’ repository. Still the device was enabled and working. I spent about 45 minutes trying to connect to my wireless router, and the lack of the wireless assistent in the original distribution install ( i know you can download one ;) ) convince me to look some where else.

3. Unbutu 6.06
If you didnt figure it out Kubuntu is bassed on Ubuntu distribution :) . So my next choise was the original thing :) ). I remembered i try’ed it once in the past and it seemed OK. And also i had a CD with it laying arround ( i had that ordered of the internet a year ago ) so i went right to work and install it. Everey thing went perfectly, all the drivers were found. The wireless connection was up&running in a minute with the wireless assitent. The only problem that i experienced was the wireless router security encription ( WPA ) that as far as i saw wasnt suported. But as soon as i changed the wirelless to WEP encription i got a conection :) . But i searched the internet and found that it is possible to do a WPA encription with unbuntu ( as soon as i managed to do this i willl post the results here ;) ). Overall i think this is my distribution to be :) .

4. SUSE 10
I also heared a lot of good things about this distribution. Unlike the previus distribution i wrote about that have usualy 1 CD, Suse has 5 CD’s.
One of the flagship features of SuSE is YaST, SuSE’s installation and system management tool. A key to a easy life with Linux is being able to easily manage the system and install software. Also i heared that this last version has an emproved Wireless Network Suport. Althogh i also have this distriution in my CD collection i din’t get a chanse to test it. As soon as i do i will inform you of my thought about it. The only thing that doesnt make me to excited about it is the fact that it need a lot of installation space.

That is it for now. I will keep you updated with the problems i face in linux and the solution i adopt, maybe some of you will use them and save some time.

Looking to you’re comments.
Cheers

Those who are looking for a career in network plus, need something more than a ccnp. That means at least a basic mcsa certification and an advanced credit from either ccna certification or an itil certification.

Enjoy!