Yesterday I was programming late at night (4 am) and all the time I had a problem with authentication when switching between web sites.
This morning I looked at the code and found out that I made a simple mistake – a typo in the code.
My advice – do not sit, and code late at night. 😉
Category Archives: job
ClearOS 6.x MultiWan
Today i have had a problem with 3 external internet connection. What i did at the very beginning of configuring it was that I haven’t choose which interface is the PRIMARY and which is BACKUP.
At the very beginning i have only one external wan so there where no problems but, after some time i have had second and about 3 month ago third external wan.
When one interface was down whole traffic did not know which other interface he had to choose 😉
Today i have set it up properly and voila everything works as planned.
QoS on ClearOS 6.5 Community Edition
Today – after struggling from the begining for network speed – i have found a very helpfull piece of software for bandwith management which was QoS (beta).
After only installing it and enabling via webconfig it starts to do its job!
Now my users stop complaining about “why the internet is soooooo sloooow?”
Amazing, really amazing….
CentOS 6.5 and OpenFire
Yesterday i have installed OpenFire on one of my CentOS servers. First I had to download it from here, and then install it via yum:
1 |
# yum localinstall openfire-3.9.3-1.i386.rpm |
Because i had 64 bit version of CentOS I had to install also glibc.i686
1 |
# yum install java glibc.i686 |
After that i had to do some things in MySQL:
1 |
# mysql -u root -p |
After that:
1 2 3 4 5 |
mysql> create database openfire; mysql> insert into mysql.user(User, Host, Password) values('openfire','127.0.0.1',PASSWORD('your.secret.password')); mysql> flush privileges; mysql> grant all privileges on openfire.* to openfire@127.0.0.1; mysql> flush privileges; |
Ok, now we have to allow some ports on firewall:
1 |
# nano /etc/sysconfig/iptables |
And add those lines
1 2 3 |
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5222 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 5223 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 9090 -j ACCEPT |
After that we have to start the openfire service and make it run through server restart
1 2 |
# service openfire start # chkconfig --level 235 openfire on |
OK, last thing is to go to your http://your.ip.address:9090 and install it 🙂
ClearOS Router
Today i have successfully deployed another ClearOS based router.
I must say that this linux distro is very easy to setup and deploy to production 🙂
Thank you ClearOS team for creating this linux distribution !
CentOS 6.x and Microsoft SQL Server ODBC Linux driver
Some days ago in my company someone asked me if we can access to our ERP software which is using Microsoft SQL Server. They want to get data to program which is writing by me using PHP and MySQL. I started to googling the net but I only found that Microsoft is providing drivers for ODBC connection. Those drivers can be found here.
Here is what i have done: (I assume that you have LAMP server setup on your CentOS 6.x)
1 |
# yum install php php-odbc wget gcc php-pear php-pecl-apc php-xml php-xmlrpc php-intl php-tidy php-imap php-pecl-memcache |
Next step was to download proper driver: For CentOS 5.x
1 |
# wget http://download.microsoft.com/download/6/A/B/6AB27E13-46AE-4CE9-AFFD-406367CADC1D/Linux5/sqlncli-11.0.1790.0.tar.gz |
For CentOS 6.x
1 |
# wget http://download.microsoft.com/download/6/A/B/6AB27E13-46AE-4CE9-AFFD-406367CADC1D/Linux6/sqlncli-11.0.1790.0.tar.gz |
Next I have to untar it
1 |
# tar xvf sqlncli-11.0.1790.0.tar.gz |
and then build it
1 2 |
# cd sqlncli-11.0.1790.0 # ./build_dm.sh |
After that:
1 2 3 |
# cd /tmp/unixODBC.5996.21582.3453/unixODBC-2.3.0 # make install # cd /path_to_sql_client_download/sqlncli-11.0.1790.0 |
And the last
1 |
# ./install.sh install --lib-dir=/usr/local/lib64 --accept-license |
Now I have to setup ODBC, so we have to edit /etc/odbc.ini file and setup proper DSNName values
1 2 3 4 5 6 7 |
[MyDSNName] Driver=SQL Server Native Client 11.0 Description=My Test ODBC Database Connection Trace=Yes Server=[My SQL Server IP address] Port=1433 Database=[my database name] |
To test it I have to use the isql command
1 |
# isql -v MyDSNName MSSqlUser MSSqlUserPassword |
I have seen something like this below
1 2 3 4 5 6 7 8 |
+---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ |
OK, now it’s time to test PHP connection – because this is what my cooworkers wanted. So let’s wrote some PHP code:
1 2 3 4 5 6 7 8 9 10 11 |
<?php $dbconn = new PDO("odbc:MyDSNName", "MSSQLUserName", "MSSQLUserPassword"); $sql = "SELECT * FROM MSSQL_DataBase;"; $stmt = $dbconn->prepare($sql); $result-> $stmt->execute(); while($row = $stmt->fetch()) { echo "$row[0] - $row[1]"; echo "<br>\n"; } ?> |
I save it under odbctest.php file. Now it’s time to test it in the linux terminal:
1 |
# php odbctest.php |
I have seen something like:
1 2 3 |
TA00003 - Name 1 TA00004 - Name 2 TA00045 - Name 45 |
Which was good. Now it’s time to test it under Apache, so a I copied this odbctest.php file under /var/www/html
1 |
# cp odbctest.php /var/www/html |
After that i run
1 |
# wget http://localhost/odbctest.php |
the download seems not working. The problem was in selinux permissions. If I do
1 |
# setenforce permissive |
then wget command will work and my webpage was accessible – until next reboot. Another way was to change the semanage context
1 |
# semanage permissive -a httpd_t |
Now after reboot it was working 🙂
Important information!
In CentOS 7 all steps will work until →# php odbctest.php. The problem is that Microsoft does’nt provide driver for RHEL/CentOS 7 branch. It only works with PHP up to 5.4 🙁
Installing SARG on ClearOS 6.x
Today i have successfully installed and configured SARG on my work ClearOS 6.x based router. Main goal was to get better reports from existing data.
What we need is:
- ClearOS 6.x
- working squid configuration (web proxy)
- working apache configuration (web server)
- working dhcp server (dhcp server)
- Installing WGET
1# yum --enablerepo=clearos-core install wget - Installing RPMForge repo
12# wget http://apt.sw.be/redhat/el6/en/i386/dag/RPMS/rpmforge-release-0.5.3-1.el6.rf.i686.rpm# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.i686.rpm
Now we have to disable rpmforge repo to avoid conflicts between different software (for example during yum update process). You have to edit /etc/yum.repos.d/rpmforge.repo and change enabled=1 to 0 (zero). - Installing SARG
1# yum --enablerepo=rpmforge-testing install sarg - Configuring SARG
You can edit /etc/sarg/sarg.conf to modify any variables you want. Also we have to fix problem with subdirectories
1234# mkdir /usr/share/sarg/# ln -s /etc/sarg/fonts/ /usr/share/sarg/# ln -s /etc/sarg/languages/ /usr/share/sarg/# ln -s /etc/sarg/images/ /usr/share/sarg/ - Testing SARG – generate one-shoot report
1# sarg -x - Access SARG reports from your IP
To see reports generated by SARG you have to edit “/etc/httpd/conf.d/sarg.conf” and the line “# Allow from your-workstation.com” to the IP of your workstation. You can add as many IP as you want. After that it is required to restart webserver
1# service httpd restart - Testing SARG scripts
123# /etc/cron.daily/sarg# /etc/cron.weekly/sarg# /etc/cron.monthly/sarg
There should be no information after running those scripts - The end
If feverything goes ok, you should visit http://you-server-ip/sarg/ to see reports generated by SARG 🙂
ps. Thanks Tony Ellis from clearfundation forum for tips how to do it right.
How to mount usb drive in ClearOS 6.4
Recently i had a problem with my server running ClearOS 6.4. One of the array hardrive goes down, and i had to recover what could be recovered (it wasn’t important server but users wanted to get back some data).
I have plugged usb 1TB drive, but the COS cannot mount it. The solution was easy:
-
1dmesg |tail
shows me that my usb drive was connected to /dev/sdb -
1fdisk -l /dev/sdb
shows me that the partition type was HPFS/NTFS - next thing was to add rpmforge repo to ClearOS (i followed instructions from CentOS wiki) but i have to install wget first 🙂
1yum install wget
because it wasn’t installed on my server. After that i do some things like:
1234wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpmrpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txtrpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpmyum install ntfs-3g - After that i created a directory in /mnt
1mkdir /mnt/usbhdd
and then do
1mount -t ntfs-3g /dev/sdb1 /mnt/usbhdd
After that i am trying to copy what i can from that array 🙂
Network card problem
After 5 hours of configuring and testing ClearOS 6.4 as a router in my company my wan network card goes crazy.
Tomorrow I will have to replace it with another (good i hope so) one…
ehhhhh
Xubuntu 12.04 LTS running on AMD X6 FX-6100
After couple of weeks i told my boss that my old hardware must be replaced. My plan was to buy hardware which would be able to serve me for testing stuff. My choice was:
CPU: AMD X6 FX-6100
RAM: Kingston 8GB HyperX Blue
Motherboard: Gigabyte GA-780T-D3L
Case: Modecom A14
Graphic card: ATi Radeon HD5450 1GB RAM DDR3
All my company runs programs which require Microsoft Windows, but i like ubuntu! So, because i don’t need any special desktop effects i have installed on that configuration Xubuntu 12.04.02 LTS. To run Windows software i have installed Oracle VirtualBox and then Windows 8 Enterprise Edition.
This is a second week when i am using that and everything works fine!