Move mySQL Directory to Home

Salams

Upon logging on to one of the servers this morning we found out the Cpanel was not working because it was complaining about / ran out of disk space

So doing a df indeed confirmed that /var folder was out of disk space and most the space was being taken up by mySQL Databases

So we needed to move this to /home and create a symlink for this

By default all mySQL database on a server is saved in /var/lib/mysql directory. If you don’t have enough space left in /var directory or if its filling up quickly, you can move your  directory to /home partition

so this is what we did

Login to SSH and do the following

//Make a backup of all databases
mysqldump --all-databases | gzip > /home/backupdatabases.sql.gz

//Stop mysql
/etc/init.d/mysql stop

//Create a new mysql directory in home
mkdir /home/mysql

//move mysql from current location to new location
mv /var/lib/mysql /home/mysql

//Set Permissions
chown -R mysql:mysql /home/mysql/mysql

//create a symlink
ln -s /home/mysql/mysql /var/lib/mysql


//restart mysql
/etc/init.d/mysql start

and there you go :) nice space freed up and all back to normal

 

Advertisements

Upgrading from Mysql 5.0 to 5.1 Via WHM – Internal Server Error

Salams

Bit of a scary ordeal today

We decided to have a crack at upgrading MYSQL from 5.0 to 5.1

So we tried attempting to do it via WHM via the MYSQL Upgrade option in Software

Seemed straight forward enough with a easy Wizard to Follow Through

So we kicked off the Install, took a while to go through everything

Then the black dialog box comes up ran some sort of script and also it seemed to be doing some database checks by going through every single mysql Table and checking to see if they were ok – Fair enough

Started with domain names from A down alphabetically..did took a while atleast 1 hour…

So then it reached domain names with Z – i thought to myself ahh finally after 1 hour of waiting just sat watching the screen (of course did not sat there the whole time went out to grab some munch for local takeaway – at this point i had left and it reached domain names starting with the letter D)…so was expecting it to complete by then………once it reached the last database if then decided to start with domain names starting by A Again……

so thought maybe it just missed out some domains  -so gave it a benefit of doubt and left it running again just incase it missed some first time around……..then when it came down to the Domain names letter C then got a bit concerned that its already done this database why is it going through it again???

So i waited another 15 mins just to see what happens and yup it went all through the list again! it seemed that it was looping althought it had reach stage 7/7 of the install something seriously was not right here!

and at this point every single MYSQL site was returning with error 500 and not accessible!

So i went to check what mysql version was installed on the server and it was reporting 5.1.x so it had upgraded ok but why was it looping and doing table checks/

at this point decided to take the risk and close that window down

Ran EasyApache had to rebuild PHP /Apache again took a while – whilst i watched anxiously after it completed all sites backup again and running Wohooo!

 

So seems a bit buggy the WHM install not sure whats up with that

but if someone has this problem then what you do is run EasyApache and recompile PHP / Apache and everything should be ok!

Quite panicky when mysql fails as 90% of sites are powered by MYSQL

Interesting evening! 🙂

 

 

wa

Installing Magento Extensions Via SSH

Salams

If you find that whilst trying to run any sort of mage command via SSH you get   ./mage:  Permission denied

then try the following:

rm -rf var/cache var/session
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force


Hopefully that should fix it!

Zip File Corrupted in Magento Downloadable Product

Salams,

Late Ramadhan Mubarak infact very late May aswell wish you all a Eid Mubarak at this stage!

Anyway heres a  problem i was scratching my head over

We tend to use Magento CMS System for our E-commerce based website and for NasheedChannel.com (Some Great Nasheeds there btw do check it out :D)

Anyway We offer the option of Digital Download for our mp3 products so people can purchase single tracks or the entire album

So we had a few issues from customers when they purchased the full album which was infact a .zip file containing all the mp3 tracks in there that after they downloaded it the file was corrupted and could not open it, this was only after being redirected the the product download link via their control panel in magento

Tried downloading it directly from the link works fine…

so it must be the way Magento is translating the URL for download (It does not give the direct URL for good reason) it comes with a different URL with a bunch of random generated characters which is good

But anyway there was a few suggestions on the internet floating around about changing .htaccess files and messing about with them …tried it all did not work

Then realised that When magento passes the URL it Compresses it again

So we already had a zip file with the mp3 that was compressed…..so when a customer purchases the the .zip file it does it again

So the best solution for this is that if you need to upload a Zip file ensure that NO COMPRESSION is set from winrar you choose “No Store” or winzip “No compression” upload it and it worked!

Yes file sizes are larger but if you cant be bothered messing around with .htaccess files etc then this is a workaround that works

HTH!

Wassalam for now!

Cpanel / WHM Access logs – Who has logged in from where

Assalamu alaykum

Today i had the unfortunate event of Witnessing one of the Reseller accounts on the Server Being Hacked into – it was a case of it being a Bad Password unfortunately.

What basically happened was this “Kiddy” This person is not worthy of being called Hacker because its not really hacking its just a bit of Kiddy Stuff trying to be Smart Aswell..but anyway

The Login using the Reseller account in WHM

Modified the Suspended Page with the usual “This page has been hacked along with the LOLZ, Dark Black Page, Animated Text and GIFs along with some awful taste of Music playing in the background” you know what i mean

Once this is modified they then went through this reseller account list and Suspended the accounts one by one!

Now when accounts are suspended they go to a custom Suspended Page which happened in this case! So when a user went to the Website they got the Suspended Page message which was infact the Page which this person created…got me for a while but i caught on in the End..so i went on the server hunt to track down what happened

First thing was to  analyse who has access to WHM / Cpanel

From SSH go to

/usr/local/cpanel/logs

The file you want to open is called

access_log

I normally do a

pico access_log via SSH

and then it will open up the log file takes a minute or so of everything single action logged via WHM / Cpanel

Quite useful for tracking down who has logged on, their IP address, their Browser and what they have run

Now Funny thing about this was on his “Modified page” he was stupid enough to leave a Pakistani Flag on there

Around the time this happened from the logs i noticed an IP address logged in using the reseller account lurking around the suspended Page and editing this then going on the “Suspend account Spree”

doing an IP lookup normally i use http://www.whois.sc this IP address resolved back to Pakistan! so that gave it away

Suffice to say that ISP has now got a blanket ban on our server

Hacking Incident i think not – but for him gloating about it being a hacking incident when it was down to bad password is laughable!

Anyway We move on and learn new things alhumdulillah all working and back to normal

RAID Upgrades

Assalamu alaykum / Greetings all!

Been a long time since we contacted you so hope everyone is doing good! Just a quick email to let you know on Friday 16th September 2011 we are planning to upgrade our RAID Drives and install Larger Hard Drives on to our Server. Therefore we will need to take the Server Offline for a few hours whilst this upgrade take place We have Scheduled it for Friday 16th September 2011 22:30PM (UK TIME), the server will be disconnected and sites will be unavailable for a period of between 3-5 hours whilst this upgrades take place during the Night We are also due to be launching our NEW Website within the coming weeks inshallah with new products and Services, higher capacity web hosting packages, Media services, Iphone Applications development and much much more!

With Regards to tomorrow you can keep up to date with the upgrade by following us through Twitter http://twitter.com/#!/safarmedia

 

SSL encryption is required for access to this server. Log in using SSL Cpanel

For some reason whenever we tried to login to cpanel via domain.com/cpanel or :2082 came up with this error message saying

SSL encryption is required for access to this server.  Log in using SSL

Then when you click on Log in using SSL browsers comes up with a warning message saying site is unsafe etc etc

So going into WHM > Tweak Settings and Changing

Always redirect to SSL
Always redirect users to the SSL/TLS ports when visiting /cpanel, /webmail, etc.
Should Fix it – however it did not in my case

so instead you can do it by editing  /var/cpanel/cpanel.config changing the following entry:

requiressl=1

Change the “1” to a “0”, and save the changes. You may also need to edit the following entry:

alwaysredirecttossl=1

If the value is a “1”, change to a “0”. Next run

/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings

and this should fix it! which it did strange!

Server Down :-(

Assalamu alaykum

Unfortunately we have had to pull the Entire MPADC Web server down due to hacking attempts on several of the Websites on the server – with certain accounts running outdated software which has caused the problem, resulting in all Websites being inaccessible for the time being until we get the issue sorted out.
Being an Islamic Webhosting company with 99% Websites being Legit Islamic Websites (The other 1% of Websites are Websites which are not Islamic Oriented Websites they are things like hotels, businesses, organisations etc!! Just incase you were thinking 1% are not Legit Islamic Websites!!!)
The hacking was unfortunately done by Muslims themselves defacing several websites and leaving “Politically Pro Islamic Messages on the Website”, Which is quite confusing and baffling to say at the very Least! Which leaves me Asking why would “Muslim Hackers” Target “Muslim Oriented Websites” Leaving Political based Messages on there! Quite Baffling to say and I cannot quite understand it!
Anyway what happened was that one of the accounts on the server was running outdated Software which had explots which allowed this hacker to gain entrance and start to deface the Websites!!)
The only thing that was deleted were index files! These are the landing page you get to each time you access a Website! so these were more or less defaced!
Other files on the website were alhumdulillah still on there
Now we had a bit of dillema either try to attempt to restore the entire index files for all the accounts we host over 200 Websites and this itself was a huge task! or do a completely fresh installation
Safer bet was do a complete installation of the operating system (The equivalent of reinstalling windows but our servers was linux) best this was done incase something else was left behind which would allow the hacker to strike back
Backups are made every night so all accounts are going to be restored from how it was Wednesday morning 6am 13th July! And sites were hacked around 16:00PM so unfortunately anything done within those 10 hours would have been lost!
We are currently working with the Systems restore team to try and fix the problem! No data has been lost we have kept backups alhumdulillah! If worst comes to worse we may have to restore the Entire backups and state of accounts from last night 13th July 2011 Last backs from 06:00am UK time
Also alhumdullilah Only index.html / index.php / default.html files has been erased all other files are completely intact! So it could be the case that we just need to replace the index files of the website which will allow it to come back online again, but once our systems restore team update me i will update out twitter page located here
Will be regularly updating the twitter feed
Once again apologies for the downtime this was totally unexpected!
Wassalam

Cpanel Backups Causes server to Hang and Eat up Memory

Salams

One of our Other dedicated servers which we use for Databases decided everynight to hang and the only way to bring it back up would be a physical reboot! Even logging in Via SSH hung!

So after weeks of trying this and that figuring what would be wrong after Multiple Hardware Changes, Kernel upgrades even new box, still the problem occured

Then we noticed it seemed to be crashing between certain times each nigh…then we figured out Backups! Cpanel backups run around that time!!

Since our backups were stored as .tar.gz alot of people on the Net were complaining of similar problems by compressing it it would eat up a lot of memory and take up huge server loads!..

 

So decided to change the backups to INCREMENTAL instead via Cpanel Backup manager! so will run that tonight and see how it goes

since its a DB server with few accounts its ideal because incremental backups takes up a lot of space! plus advantage is that if someone accidentally deleted a file no need for us to restore the entire acccount! we could just pick the file that needed restoring

 

will see how it goes tonight Inshallah ! and will update the blog!