-
Notifications
You must be signed in to change notification settings - Fork 42
Quickstart Guide For Unix
Unix includes things like Linux, Mac OS X, Ubuntu, BSD, Fedora, Redhat, etc...
Basically, if it's not Windows, it's Unix.
The tool we rely on to install Perl in your home directory and configure everything is perlbrew. Everything that happens here is happening in your home directory.
While most Perl modules are written in Perl, a lot use C and need a C compiler. And most need a utility called "make". Many Unixes come with all that already installed. You can check with make -v
and gcc -v
.
Here's how to get the C build tools and make on common Unixes.
OS X does not come with make and a C compiler, you'll have to download either Xcode from the App store or you can get the much smaller "Command Line Tools" from Downloads for Apple Developers.
sudo apt-get install build-essential
sudo yum groupinstall "Development tools"
This will configure your CPAN shells to install into your home directory (so you don't need root), install cpanm (a friendlier CPAN client), and install perl5i.
curl -L https://raw.github.com/schwern/perl5i/master/local-lib-rc > ~/.locallibrc
echo 'source ~/.locallibrc' >> ~/.bashrc
source ~/.locallibrc
curl -L http://cpanmin.us | perl - App::cpanminus
cpanm perl5i
This will install a new Perl in your home directory (so you don't need root), install cpanm, and install perl5i.
curl -kL http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile
perlbrew install --switch stable
perlbrew install-cpanm
cpanm perl5i
perl -e 'use perl5i::2; say "Hello perl5i!"'
Follow the directions on the perlbrew home page. For most folks this should be:
curl -kL http://install.perlbrew.pl | bash
Then make sure its available for use.
source ~/perl5/perlbrew/etc/bashrc
Run perlbrew init
. This will initialize perlbrew and create ~/perl5/perlbrew/
.
Then it will tell you to add a line to your ~/.bash_profile
. Do that. This line will let perlbrew find perl and configure CPAN.
If you don't have a ~/.bash_profile
make one with your favorite text editor or run...
echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile
As of this writing, the latest version of perl is 5.16.3. Let's install that.
perlbrew install perl-5.16.3
This will download, build, test and install perl. It will take anywhere from 5 minutes to half an hour depending on how fast your Internet and computer is. Have a sandwich.
Tell perlbrew that you want your default perl to be the 5.16.3 you just installed.
perlbrew switch perl-5.16.3
You can check that worked by running perl -v
. It should say This is perl 5, version 16, subversion 3 (v5.16.3) built for something-something-something
and then a copyright and license.
cpanm is what we'll be using to install perl5i. perlbrew can take care of installing and configuring it.
perlbrew install-cpanm
You can check that worked by running which cpanm
. The result should be something like /home/yourname/perl5/perlbrew/bin/cpanm
.
And finally, you can install perl5i!
cpanm perl5i
This will install a lot of modules. It could take a while. Kick back and relax.
Now you can test that perl5i is installed by running...
perl -e 'use perl5i::2; say "Hello perl5i!"'
And you should see Hello perl5i!
.
Congratulations!