Tag Archives: linux

Creating your PHP Onboarding for Windows machines

There are many many ways to have a full LAMP stack on a Windows machine and use it for PHP development like WAMP, for example. This is ok if you are developing just for fun, but in corporate level an on-boarding environment is much preferred. Having a pre-defined server image with all that is necessary to almost replicate your production server on a developer machine helps on preventing errors and, most importantly, quickly have new developers up-to-speed with the corporation development environment.

Consider that you would need:

  • Apache
  • PHP
  • MySQL
  • Memcache
  • APC
  • some extra libs
  • GIT repository

Creating this under windows can be such a hassle and in cases like this bundled solutions does not work.

To create a full LAMP stack on your windows machine and have it 100% stand-alone I have used Vagrant. On the prior version of Vagrant (V1) you had to use Putty in order to ssh to the VM and that was a painful process, with the newer version (V2) you can use built in Vagrant SSH as long you install an SSH support library like the one from GIT. There is a trick on the GIT installation, you must choose the option with the Linux / Unix commands (it has a red warning message about overwriting windows libs).

Prior installing Vagrant you will need to install Virtual Box. It is a Oracle virtual box machine. Very useful if you are on OSX or Linux and need to run tests on Windows IE9 (sig). This part of the process is very well explained on the Vagrant documentation.

Now comes to Vagrant install. It is fairly easy. Install Vagrant, then open command line and run “vagrant init”. It will create a default vagrant file with most of the basic things defined. Here comes a trick. The default vagrant file tries to download the precise VM.  I have tried to contact Vagrant a couple times on Twitter and with no luck. There is an issue with the download of this box, the server resets the connection prior the download to be finished.

There is a way out of this: VagrantBox.es – Select the box that you best consider that matches your environment, add it on vagrant (vagrant box add) and finally update the vagrant file to use the new added box.

After this, everything is as simple as setting up the environment. Unless you have an specific need to add the GIT repository files under another folder you can set it all under the vagrant folder (same folder where the vagrant file is located).

I could use the GIT command line on windows to clone / commit my repositories, but using the GIT windows tool from GitHub is way too fun 😀

I know that most of PHP developers use either Linux or OSX for development. It is much easier to setup and use, but if you are stuck with Windows, you might as well benefit of this.

Just a note, off course the main environment mentioned here was LAMP, but this same process can be used for Ruby, Phyton and may other hipster languages available =D

 

Updates:

I had a networking issue with the current box that I’m using. It seems that it is a common issue with some boxes as mentioned here – https://groups.google.com/forum/?fromgroups=#!topic/vagrant-up/Yeu6UF-GJO8

To fix run this: sudo /etc/init.d/networking restart

If you never installed a LAMP stack before, this article here will give you all the steps to install it correctly: http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-12.04-lts-lamp

Advertisements

Great resource for Linux

From Installing PHP to much more: http://www.howtoforge.com/


BHack

Nice event going on on Brazil (and damm cheat too) on one of the most beautiful cities in Brazil too – http://bhack.com.br/ – security, hacks and much more. Keep your linux flash drives up and get your plane tickets.

Date: 14 – 17 June

Don’t miss.


Setting up email server on Linux environment

I was looking for something else when I came across this tutorial and it is really great. Check it out:

http://flurdy.com/docs/postfix/


My 1st impressions of a MAC

I have been always working with Windows and recently I have changed to Linux so it would be possible to boost my Desktop performance without much investment.

Working with Xubuntu for the past months has been wonderful, but now a major performance was need for necessary work. Talking with colleagues and friends, I have choosen a MacBook Pro, a extremly light weight notebook with a lot of power for the size.

Going to the Apple Store was fun. I had come to a store employee and told him that I needed a MacBook Pro that could hold a couple of Virtual Machines running at time and one of them was Linux. He got spooked, but actually helped a ton on choosing the correct one.

Easy setup, beautiful opening and yes, it is impressive. The first steps where easy, installing Skype, MSN Messenger Live, configuring email, installing the Eclipse PDT, VPN and installing VirtualBox, my main reason for using a Mac. I got pretty part of the setup of my environment done until I got stuck into some small problems.

Getting Apache working, configuring the httpd.conf and setting up some other development stuff. It took time, but most is done, now is just fine tunning.

There are some tricks that are usefull on a Mac and those I have learned today. Don’t get me wrong, I’m a confessed newbie on Mac’s, even knowing that I have already used Linux for a long time (believe me, it’s very similar, including commands, but is not the same).

The best trick: Use sudo nano to edit files that you wouldn’t normally do with a text editor because you don’t have permissions or the system don’t have permissions to it.

A very useful trick: Hit command + space to open the Spotlight. A mix of finder with run that allows you to execute command that is being searched and open documents.

There is much to learn with a Mac. Feels like that I’m on a Linux that was transformed into a “good guy” that can play cool games. Well, maybe we can change it back to a “bad boy” (Linux) and still play cool games 😉

So far, working with it has been wonderful, let’s see how it goes when I push it to the limit…


Samba and Vista

I was having this little bit of trouble with Windows Vista accessing my files on the SAMBA server.

After a little research I have found a great post wich gives a great trick to work out the imcopatibility issues between Vista and Samba.

Follow the link: Get Vista and Samba to work


Back to old reliable Xubuntu 9.04

Yesterday, after spending some hours to get all development eviroment set, I have managed to finish the installation of the good and old Xubuntu 9.04.

It’s a bit faster than the 9.10 and so far, no errors what so ever. Next step, wait for the next stable release for Xubuntu and check out some forums before the upgrade.


Downgrading your Xubuntu Core

I’m having problems with my new updated Xubuntu core as I have mentioned at my previous post.

After some good search and reading I have found a possible solution. There is a good way to downgrade your core without major incidents.

Here are the steps (got from Ubuntu Forums)

1. Reboot your machine and when Xubuntu is about to start hit ESC (or the key set to show the menu options at boot). You should see about 3 to 5 entries where one of them should be a older version of your core. Choose the right version and you are done.

Now if you don’t see the right core, then this is what you need to do:

1. Using Synaptic install a linux-image (use linux-image to search in synaptic) that reflect the right core that you want to downgrade. Take note on the information about the core. Ex.: 2.6.31-14-generic

2. Open your menu list at your Grub boot menu and see what options do you have to start your Xubuntu (use terminal).

mousepad /boot/grub/menu.lst

Now add the new menu core installed following the same format as the other ones.

title        Ubuntu 9.10, kernel 2.6.31-14-generic
root         ()/ubuntu/disks
kernel       /boot/vmlinuz-2.6.31-14-generic root=UUID=xxxxxxxxxxxxxx loop=/ubuntu/disks/root.disk ro ROOTFLAGS=syncio quiet splash
initrd       /boot/initrd.img-2.6.31-14-generic

title        Ubuntu 9.10, kernel 2.6.31-14-generic (recovery mode)
root         ()/ubuntu/disks
kernel       /boot/vmlinuz-2.6.31-14-generic root=UUID=xxxxxxxxxxxxxxx loop=/ubuntu/disks/root.disk ro ROOTFLAGS=syncio  single
initrd       /boot/initrd.img-2.6.31-14-generic

Remember to always have your files backup. No matter if you are on Windows, Linux or Mac, a full recovery can always brings unexpected results (even knowing that on Linux is mostly likely to have a smooth transition).


Installing SAMBA on Xubuntu

samba is by far the best file / printer sharing service available for Linux. It will surely provides a way to share folders, files and printers with Linux systems and Windows systems, therefore installing it on Xubuntu have some tricks.

First, using Synaptic (or apt-get) install samba (lower case). It will also ask to install other libraries and install them as well.

The next step is to install swat (lower case) a web management tool for SAMBA. Just like SAMBA you can either use the Synaptic or the apt-get to install it.

Now come the tricks.

First make sure that the that the #<off># is removed in the /etc/inetd.conf file.

Now, with apt-get, install the xinetd server. This is the second most important step to allow SAMBA and SWAT to work together.

To finalize, open the xinetd.conf file (/etc/xinetd.conf) and add before the xinetd.d include:

# description: SAMBA SWAT
service swat
{
disable = no
socket_type = stream
protocol = tcp
user = root
wait = no
server = /usr/sbin/swat
port = 901
}

With this it will be possible to access SWAT by 127.0.0.1:901 at your browser.

By default it will only enable the printer sharing to any users. To allow folder sharing, you must go to:

[Menu] Applications -> System -> Shared folders.

Now all is left is to configure SAMBA, a task that using SWAT, becomes very easy.

Have fun.


Context menu disable with JQuery

I have found a ton of tutorials teaching how to disable the context menu on browsers and in all of them I have found one flaw:

Does not work with Opera

It’s an anoying situation that got me thinking and searching for a solution through most part of the day and with no luck.

The function is simple:

$(document).ready(function()
{
$(document).bind(“contextmenu”, function(e)
{
return false;
});
});

and it works with (tested):

and it does not work with (tested)

After a lot of research I have found why it does not work with Opera:

Opera (9.5) has an option to allow scripts to detect right-clicks, but it is disabled by default. Furthermore, Opera still doesn’t allow JavaScript to disable the browser’s default context menu which causes a usability conflict.

You can try to disable by disabling the mousedown event filtering only for Opera, but I do suggest a lot testing on this.

To complete just an extra note: this function does not bind the documents inside an iframe, so in this case you should complete the function by disabling the context menu in the iframe document as well.


%d bloggers like this: