installing java and maven on CentOS

java, maven

installed java:

yum install java-1.6.0-openjdk

yum install java-1.6.0-openjdk-devel
installed maven:
wget http://ftp.tsukuba.wide.ad.jp/software/apache/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
tar xzvf apache-maven-3.0.4-bin.tar.gz
mv apache-maven-3.0.4 /usr/local
cd /usr/local
ln -s apache-maven-3.0.4 maven
vim ~/.bashrc
>> added:
export M2_HOME=/usr/local/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
touch /etc/profile.d/maven.sh
>> added:
export M2_HOME=/usr/local/maven

export PATH=${M2_HOME}/bin:${PATH}

installing git on CentOS

git

to install git on CentOS, simply follow these instructions:

yum install gettext-devel openssl-devel expat-devel curl-devel zlib-devel
wget http://git-core.googlecode.com/files/git-1.8.0.tar.gz
tar xzvf git-1.8.0.tar.gz
cd git-1.8.0
make prefix=/usr/local all
make prefix=/usr/local install
[root@server1 git-1.8.0]# whereis git
git: /usr/local/bin/git

MySQL insert into user database failure

mysql

I kept getting an error for “Column count doesn’t match value count at row 1″.

My MySQL [5.0.96] version probably had some extra columns. So…

INSERT INTO user VALUES (‘localhost’,’root’,password(‘newpassword’),’Y’,’Y ‘,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’, ‘Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,” ,”,”,”,0,0,0,0);

mysql remote connection kept failing

iptables, mysql

My connection to a remote server on a local network kept failing. Of course the problem was iptables. The error for MySQL was an error code 113.

iptables -I RH-Firewall-1-INPUT -p tcp –dport 3306 -j ACCEPT
iptables -I RH-Firewall-1-INPUT -p udp –dport 3306 -j ACCEPT

Redirecting outbound email with exim

exim, linux

I wanted to build a replica of our production environment on a development environment, one problem being that our production environment sends a lot of emails to our clients.

I therefore needed to redirect or restrict all of our outbound emails.

With that in mind, I needed to make sure that exim [typically what we use to send mails] would not be able to send any mail to our clients, and instead it would be sending mails to a manually defined inbox.

The first thing I needed to do, was check that exim was actually working.

I sent myself an email:

/usr/sbin/exim -v ‘alex@myemail.com’
Some message here
[CTRL+D]

That  then responded with the 250 OK codes to confirm that the mail had been delivered to myself.

That’s no good on this environment though, as I needed to ensure that exim would be redirecting to a defined mailbox. Let’s call it “some@mailbox.com”

To do this, I needed to change the routers on the exim configuration file (/etc/exim/exim.cnf).

In vim, search for the string “begin routers”

The crucial point here is that the order of which the routers are defined is important, so you will need to put the new, first rule for routers at the top of this section. What did I include?

blah:
driver = redirect
domains = whereitscomingfrom.com
data = some@mailbox.com

I then repeated the mail send:

/usr/sbin/exim -v ‘alex@myemail.com’
Some message here
[CTRL+D]

I could then see a 250 OK code, but it was actually going to some@mailbox.com instead.

Some useful links for NFS Sharing

iptables, linux

I’d forgotten to set my ip tables:

http://eduardo-lago.blogspot.jp/2012/02/installing-nfs-on-centos-62.html

So my NFS shares weren’t working.

This was a useful page:

http://qugstart.com/blog/linux/centos-nfs-how-to-guide-exporting-and-mounting-a-nfs-drive/

MySQL limited records in mysqldump

mysql

When I wanted to mysqldump a limited amount of records, I used the below command to limit my mysql dump to just 1 million records.

mysqldump -uroot -hsome-db02 -P3313 a_shard_07 table –where=”TRUE ORDER BY table_id LIMIT 1000000″ | gzip -c | cat > /db/disk/myDump.sql.gz