Showing entries 1 to 10 of 30
10 Older Entries »
Displaying posts with tag: System admin (reset)
PHP: Curl being slow from php call on CentOS 5.4

I ran into an issue where curl request run within few ms from command line but same url fetch was taking over 10 secs. After doing some debugging and research it turned out that call to check (getaddr ipv6 was timing out. Obviously you can do multiple things to fix this (including enabling ipv6 support) but since I did not have a need for ipv6 (it is disabled in my network configuration), I decided to recompile curl and disable ipv6. Here is the command for recompiling curl and installing into /usr/local/curl directory with ipv6 disabled.

./configure –prefix=/usr/local/curl –disable-ipv6

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

SVN: How do you use svn command line on Windows with ssh tunneling?

If you ever used svn command line, you know it is not optimal to type in your password every time you do checkout, checkin, info, etc.  In linux world, it is very easy to setup keys to get around this.  Of course in the world of Windows it is not as easy.  Here are the steps you need to follow to get private/public keys working with your SVN under Windows using ssh tunneling.

Assumptions:  you will be connecting as user “root” to svn server located at “10.0.0.1”.  All your files will be saved at c:\ including your svn command line utility

First we will have to generate a key.  We can accomplish this by using a free utility called …

[Read more]
sshfs: How do you install sshfs and fuse? [CentOS/Linux/Redhat]

One may wonder what is sshfs and why would you want it?  Well simply put, sshfs allows you to mount another server’s filesystem into a folder on your local system which in the background is doing ssh commands and transfers.  As a mounted folder, you are able to move about and copy files back and forth as everything was on local server.  As you can see this makes it very easy for you to work with files on multiple servers.

Note:  you only have to do the following installations on the server where you are doing the mounts on.

Let us download and install the filesystem framework which is a requirement for sshfs called fuse.

wget http://voxel.dl.sourceforge.net/sourceforge/fuse/fuse-2.7.4.tar.gz
tar zxpfv fuse-*.gz
cd fuse*
./configure

If you get the following error, you will either have to point to the location of the kernel source or …

[Read more]
Linux: How do you find out what your server’s outgoing ip is?

There are many times when I needed to find out my outgoing (or external) IP for the servers which are behind load balancers or firewalls.  I used to just login to another external server from the server in question and find out by looking at “who” what my external ip is.  Even though it works and I am so used to it, today I decided to figure out a more graceful way of finding my outgoing ip.  As most of us already know, whatismyip.com is the quickest way to find out your outgoing ip from the browser.  So I decided to use the same way on the servers.  So I issued a wget:

wget http://www.whatismyip.org

Well that does the trick.  But being lazy as I am, I did not want to have to cat the output file to find out the ip (plus there is no point of creating extra files and doing extra work to remove them).  …

[Read more]
Apache/http monitoring: monitor http traffic in realtime using httptop

Server monitoring is a big part of running a solid web site.  As an admin, you must know what is going on your server.  One of the tools most Linux/Unix admins are used to is called “top”.  “top” by itself is a very powerful tool.  Here is a quick guide on how to read output from top:  introduction to load averages under top.  It just makes sense that somebody went and created httptop to monitor http traffic.

Install perl modules:

install Term::ReadKey
install File::Tail
install Time::HiRes

Now copy paste the script below and save it in a location and set +x attribute on it so you can execute it.  On my …

[Read more]
MySQL: How do you enable sphinxse (Sphinx Storage Engine) in your mysql installation?

As you may know mysql fulltext search is not highly scalable.  One of the options to get around this scalability limitation, which I prefer, is to use Sphinx.  You can use Sphinx with out having to alter your mysql installation.  But, if you would like to use from within mysql and not have to worry about how to pass data between Sphinx and MySQL, you can enable sphinxse (sphinx storage engine).  It is not included with mysql by default so you will have to compile it yourself.

Here are the instructions on how to get sphinxse compiled with your mysql installation on CentOS x64.  I am sure same instructions will work for other flavors but I have not tested it.  I will be compiling the most current version of sphinx (0.9.8) with most current stable version of mysql (5.0.51b) at the time of the writing.  Let’s get the appropriate …

[Read more]
Linux: yum options you may not know exist.

Most of the users who work with distributions such as: centos, fedora, redhat, etc use yum as a package update/installer. Most of them know how to do “yum update [packagename]” (to update all or [certain packages]) or they do “yum install packagename” to install certain package(s). But yum can do so much more. Here are some options you may find useful:

Following command will search for the string you specified. Generally this will give you all of the packages which has specified string in title or description. Most of the time you will have to look through a lot of output to find what you are looking for.

yum search string

Probably one of the most important options for yum is provides/whatprovides. If you know what command you need, you can find out what package you have to install in order to have that command available to you.

yum provides (or whatprovides) command

[Read more]
Apache2 gzip compression: How do I speed up my website download time?

One of the things people tend to forget is the ability for web servers to compress content before sending it back to client. Client’s browser then uncompresses the data and displays it to the user. Pretty much all of the recent browsers support gzip compression. In this post, I will go over how to setup apache2 to use compression. First let’s see if your Apache installation has “deflate” enabled. You can check to see if you have deflate by typing:

# /usr/local/apache2/bin/apachectl -t -D DUMP_MODULES
Loaded Modules:
...
deflate_module (static)
...
Syntax OK

If you don’t have have deflate_module, you would have to recompile your apache with “–enable-deflate” option.

Going forward, I am going to assume you have deflate_module. Add the following to your apache conf file:

<Location />
SetOutputFilter DEFLATE
BrowserMatch …

[Read more]
Linux: How do you rename a user account in linux?

In Linux, there is no command which will rename a user account. If you make a mistake creating a user account, user changes their name or if user does not like his user name, there is no real easy way of going and making the change. Only thing I know you can do is to go through some files and rename user manually. Let us say that we have a user who is named joe and we want to rename him to john.

Note: you must be logged in as root to do following.

vi /etc/passwd
find joe and change it to john, save/exit

vi /etc/group
find joe and change it to john, save/exit

vi /etc/shadow
find joe and change it to john. This file is read only and you have to force overwrite it. In vi it is :w! once saved, quit.

cd /home
mv joe john

And that should do the trick.

[Edited] Right after I posted this post, I was contacted and was told to look at utility called usermod. Read …

[Read more]
MySQL: How do you set up master-master replication in MySQL? (CentOS, RHEL, Fedora)

Setting up master-master replication in MySQL is very similar to how we set up master/slave replication. You can read up about how to setup master/slave replication in my previous post: How to set up master/slave replication in MySQL. There is obviously pros and cons about using master/master replication. But this is not [...]

[Read more]
Showing entries 1 to 10 of 30
10 Older Entries »