cent-os basics
Today I had someone reach out to me via chat and ask a basic question…
My VPS is based on CentOS 6 but it does not even have wget – how can I install the development tools?
Yum is a great friend to any CentOS system administrator – I suggest beginning with the following few commands
1. yum update -y
once complete add
2. yum install nano screen wget -y
once complete then do
3. yum groupinstall ‘Base’ -y
4. yum groupinstall ‘Development Tools’ -y
5. yum groupinstall ‘Perl Support’ -y
If you wish to know the other groupinstall groups available – simply use this command
yum grouplist
Use SSH to bypass a firewall OR Browse Securely
With applications on public wifi points like FireSheep, and corporate firewalls blocking access to most locations on the internet of interest – the question comes up quite regularly ” How can I keep secure while on public wifi” or ” How can I bypass my companies firewall.”
This is actually very simple – If you have linux running at home – or have a webserver with access on the internet – follow this brief tutorial.
ssh -C2qTnN -D 8080 username@remote_machine.com
Type this into your local putty or terminal console.
To explain what is happening – in short what we are doing is taking Port 8080 on your local system – and forcing all traffic on that port to your remote ssh server using the username chosen. I STRONGLY URGE YOU NOT TO USE THE ROOT USER !
The options in order we are using are: Compression, SSH2 (for security) Quite, Force, Pseudo-TTY Allocation, Redirection stdin away rom /dev/null – and finally placing the ssh client into “MASTER” for connection sharing.
The next step is quite simple – just go into your browser(s) and set them to use a proxy server – in this case it is simply localhost using port 8080.
If you find you need some tweaking for speed – please let me know as there are a ton of options we can help set in your browser’s about:config section.
Greater Love – a 9/11 memory
To many when we see the American Flag we see it as a National symbol – however on 9/11 and the days following while working at ground zero as a Paramedic involved with the search and rescue the flag became something more. Each time a fellow brother in Fire or Police were pulled from the rubble – they were placed in a stokes basket and the basket was draped with an American Flag.
Even now 10 years later each time I see the American Flag, be it as a sticker on the side of a police vehicle, waiving at the Ford dealership or even on someones shirt – I remember the many bodies I had the privileged to help carry to peace. For years I had worked in EMS and Fire – I have had to deal with many fatalities from innocent children to gang members who were in their own version of war – but 9/11 and the months following to this day still haunt my soul.
While driving in to the city our ambulance was rocked by people holding signs – and stopping us to hand us water, hugs – prayers and sharing tears – I had a rookie on board who was driving. He thought it was best to use the siren to get the people out of the way so we could get through the city to our staging area. I calmly reached over and turned the siren off – as I looked at the peoples faces I realized something – We, coming in from Southern New Jersey, were literally the only sign of hope in a city in despair -masked in acres of rubble where roads, cars and a concrete haze hid the scorched and scared faces that were looking at us empty – left without meaning. The siren only added to the shock – and our presence was supposed to be calming.
If you have ever been to New York – you will learn that even at the latest hour of the day – there are cars and buses – taxis and limo’s driving people all over the city – it was an eerie feeling as we drew closer to ground zero – We saw a sea of people all walking, some so drained mentally and emotionally you could see they were using every last ounce of their strength to drag themselves just to the next step. – and suddenly it was all quite. Hardly a sound. When we arrived just one block down from the collapse of the first tower – on Vesey street the realization of the devastation set in.
Pallets and Pallets of water and other items were just sitting in the street. We were assigned to go through the many surrounding buildings to search for survivors – sadly we did not find many. I can remember a secondary collapse in which I had to dive under a fire truck for safety – all the while thinking if the building is coming down there is no way this truck is going to save me. The first rule any EMS, Firefighter or Police officer learns is Scene Safety – look out for potential hazards. The truth is – the members of the FDNY, NYPD and the Port Authority Police knew they were running in to the most dangerous situation. As bodies were descending at the speed of gravity they were climbing as quickly as possible. Scene safety was not paramount upon arrival for these Hero’s but rather getting in – and saving as many lives as possible – even knowing that their own was not in jeopardy but already over.
A few mornings later I was exhausted and walking back from the Cafeteria – a fancy name for what really was a boat which until the terrorist attack was used to shuttle tourists around the water ways so they could “tour the city” and I found a priest ripping off his clothes screaming at God asking Him Why and Where. Where are you now God… he demanded to know. I walked over to help what obviously any EMT trained would could identify as a man who was mentally breaking down and in need of help.
I asked him his name – and he answered – I asked him why he doubted God’s presence and he pulled me by my collar over to a blue suv and read to me the note out loud -
“Dear NYPD – I am a nurse – Please don’t tow my car – AND if you find this please tell my husband and my children that I love them and if I do not make it let them know I am fulfilling John 15:13″
He demanded to know from me how God could let this happen. I sat with him for what seemed like hours – but was really only just a few minutes and felt the warm glow of the sun coming up over the horizon – as I looked up I saw a cross in the distance – this cross had tons of workers underneath it digging and working, struggling to find any one who could have possibly survived. I
answered the priest and said – until now I never really could answer your question – or even that question for myself long before what happened yesterday but I do know one thing – Even as I walk through this Valley of Death the Lord is near me – He comforts Me and in the end I will lie down in Green Pastures. I pointed to the Cross – and he asked me if I would pray for him as he had “lost the words to speak to God”, I began with the Lord’s prayer – which he recited with me.
I never was able to find that priest again – even after searching – but I will never forget what he told me ” Glenn, I have a renewed faith and even in this tragedy I know that it is a promise SURELY goodness and mercy – the Love of our Father will follow us all the days of our lives – let me go and share the good news.”
With that I returned to the gator crew I was assigned to picking through the rubble.
For those who are struggling – I want to simply remind you also of that promise God has made us – He will Never Leave us or Forsake us – even when we are walking through the valley of the shadow of Death – His Rod and His staff are there to comfort us.
While driving back home I stopped at a small Baptist church in Hoboken NJ on the other side of the tunnel – ran to find a bible and opened it to John 15:13 I found something I learned as a child and had forgotten…
From the over 350 EMS, Fire and Police officers – as well as the countless other volunteers including building security and the other nameless who helped, from the folks who downed the plane in Shanksville PA, and from that nurse who most assuredly was killed we as a nation learned a lesson that most have already forgotten – except perhaps those who are still serving daily putting their lives in front of harms way day by day: “Greater love hath no man than this, that a man lay down his life for his friends.”
how to protect your MacBook Pro
This week while at the Greater NJ Annual Conference of the United Methodist Church something sad happened at the very end.
One of the key musicians, Mark’s laptop was stolen. He had just purchased the laptop just a few days earlier (Tuesday I believe he said.) This happened from what we can tell right at the end of the conference – and of course there were vendors and conference folks all over the place helping tear down – thus who knows where it is… We are hoping it was just collected up by someone who mistook it for theirs… (alas i think we are dreaming… anyhow)
I remember a posting from @ClifGuy who had his laptop stolen right out of another #CITRT members car in Florida – and at that time Windows PC security options were discussed – but not Apple/MAC.
So – here you go MAC Fans:
- Never EVER leave your MacBook unattended, not even briefly. Be aware of your laptop, as you would a purse, in airports, hotel rooms, restaurants, libraries, dorm rooms, and even @ a Church gathering.
- - Always Back up your data regularly. You should do this anyway, in case of hardware failure or software bugs, but it is also critical in case or loss of theft. Mac makes this easy with the Time Machine option – however a good online backup application would be wise to use
- - Use a security cable. Simply put – its like a bicycle chain for your machine. They simply can’t cut it and walk off w/o someone noticing… we would hope… and even if they could – it stops the simple opportunist from jacking your mac
- - Use motion sensors, either with hardware (Targus DEFCON, MicroSaver Alarmed Lock) or software (TheftSensor) .
- - Be less conspicuous. Carry your MacBook in a backpack instead of a laptop case… people might not know whats in there.
- - Choose appropriate passwords and make use of them. Don’t use guessable passwords. Log out when not using your MacBook.
- - Set a firmware password. Use EFI (Intel) or Open Firmware (PPC) to set a password that prevents booting from another disk.
- - Use encryption. Consider which data on your MacBook is most sensitive and take care to protect it. Use Apple’s FileVault feature on your home directory or utilize the Disk Utility or DropDMG for convenience.
- - Install anti-theft software. Use a software package that “phones home” on the Internet or over a phone line (Undercover, LoJack for Laptops).
- - Have separate logins. You might have one login for your routine documents but for important secure files – use FileVault on another login. By having a third login, with no password, you invite a thief to log in that way, making it more likely that they will connect to the Internet and activate the anti-theft software.
- - Recordkeeping. Record your MacBook serial number and keep this information on paper somewhere- or even better take pictures and upload them to somewhere online you can always get to – and make sure that is password protected of course. Register your purchase. Keep track of what personal information you have on your MacBook, so you know what you’ve lost, what passwords to change, etc.
- - Insurance. Check if loss or theft of your MacBook is already covered under an insurance policy you have – such as your credit card. If not, get renter’s insurance, a rider on a homeowner’s policy, or some other type of coverage- and make sure the deductible is low enough for it not to matter if it gets lost.
- - Be sure to Avoid viruses/adware/spyware. Install all security updates to Mac OS X or other software. At present you don’t need any special software for Macs – I suggest using the ClamAV for MAC located here: http://www.clamxav.com/index.php .
- - Keep your personal computer personal.In other words – NEVER LEND IT OUT. And if you need to – use a separate login for them – thus insuring the security on your system.
Any other suggestions – please feel free to add them .
MySQL Cluster Bandwidth Relief
I have been toying with having offsite backups for our MySQL databases - The idea is – all data could be offsite in case of a major fire or another issue.
I setup a radio link between our new office and our old using a Ubiquity NanoStation – and the bandwidth is Awesome – however… so is the amount of informaiton.
MySQL replication however – as its nature is – any Insert, Update, or Delete statements are written to the binary log, then sent from the master server in the datacenter to our new office.
I have been running this setup now for a short time – however I noticed today – that the slave server has been crawling – and unable to keep up. So – in hunting – I cound that there is a sizable amount of bandwidth flowing between the two – not counting the other file backups going over the same link.
It seems that there is not enough bandwidth over this radio link to keep up with the replication… After a bit of hunting - I found the slave_compressed_protocol setting in MySQL which allows the master and slave to compress the replication data between the two servers exists.. After enabling that, the slave was able to catch up within a matter of minutes and has stayed caught up just fine. The bandwidth usage has dropped a huge amount. Next is coming the SSH compression – and I think the logs – which go through the SSH tunnel will most likely have similar success.
MySQL Dump to another server
Recently – while doing some work for COR.org – I was asked how to dump a database from one server to another… (mysql)
The first thought was to run mysqldump dump on the destination machine, and to access the database over the network. That however, doesn’t compress or encrypt the data. Plus I would have had to create a mysql user with permission to access the database remotely.
The solution used instead worked out well: mysqldump directly to the remote host with this command:
mysqldump <DATABASE_NAME> [mysqldump options] | gzip -c | ssh user@remotehost "cat > /path/to/some-file.sql.gz"
In short – this method pipes the mysqldump command through gzip, then to through and SSH connection. SSH on the remote side runs the ‘cat’ command to read the stdin, then redirects that to the actual file where you want it saved.
Sleeping for a random amount of time in a shell script
Ever want to make a shell script pause…
You can use the special $RANDOM environment variable to get a random number and then divide it by the maximum number of seconds that you want to wait. Use the remainder as the number of seconds to sleep since it will always be between zero and the max you specified. This example will sleep anywhere between zero and 10 minutes (600 seconds)
/bin/sleep/sleep `/usr/bin/expr $RANDOM % 600`
Of course – those who really are keen will note that it isn’t truly random. The maximum value for $RANDOM is 32767 which is not evenly divisible by most likely values – but its close enough for me
MySQL optimization post 1
Well recently after moving MySQL to a remote server – we noticed it simply just locked up.
After peeking I noticed someone changed the my.cnf file around -and thus this is my own quite little slap on the head to that person
The MySQL server has a ton of variables – and depending on how they are adjusted MySQL will work well – or …. just stop all together.
One of the largest issues w/ a bad my.cnf configuration will be seen in I/O workload. If you are running, like we are, InnoDB and MyISAM (as well as I guess I should include Berkeley DB (DBD) and also HEAP for that matter) – there are some variables that will impact memory and I/O.
for InnoDB – these generally do not matter as much:
· bulk_insert_buffer_size
· key_buffer_size
· key_cache_age_threshold, key_cache_block_size, key_cache_division_limit
· read_buffer_size, read_rnd_buffer_size
however – for the case of this writeup – I will list the many that apply to virturally all storage engines.
· join_buffer_size – A buffer used for full join. If you have large joins without indexes, increase this buffer size to improve the efficiency.
· sort_buffer_size – A buffer used for the sort result set allocated by each thread. This can speed up GROUP BY as well as ORDER BY queries.
· query_cache_size – Simply set this variable to a nonzero value to enable query caching and change as needed.
· query_cache_limit – The maximum size of the cached result set. Keep in mind – the larger result set won’t be cached .
· query_cache_min_res_unit –This allocates query cache memory blocks with the minimum size set by this variable. Sadly – when the application has a lot of small query results – the default block size of 4K can lead to memory fragmentation… So – with small result sets simply decreasing it to 1024 or 2048 bytes may improve performance. Conversely – with large query result sets increasing it to 8192, 16384 or more may improve performance.
More to follow later
Looking into testing mysql on a SDD drive soon enough
Pages
Tags
apple Archived asperger's autism blogging cat6 Chatter Church cisco citrt comcast convention cPanel datacenter debugging mysql devil evangelism facebook faith family iPad iPhone iscsi Leadership Linux MAC Marketing Microsoft MySQL network Off the wall crazy OpenSource or just weirdly different pfsense politics Ramblings review Security skype Sprint Storage Technology Web 2.0 minus or plus Wifi wisp

