Is it possible to install addition locale in the nitrous.io's box? - nitrousio

I see alot of supported locales in my box:
$ less /usr/share/i18n/SUPPORTED
but installed only en_US:
$ locale -a
C
C.UTF-8
en_US.utf8
POSIX
How can I add additional locales?

Related

Difficulty installing JSON module for Perl on Mac [duplicate]

I get this error:
Can't locate Foo.pm in #INC
Is there an easier way to install it than downloading, untarring, making, etc?
On Unix:
usually you start cpan in your shell:
$ cpan
and type
install Chocolate::Belgian
or in short form:
cpan Chocolate::Belgian
On Windows:
If you're using ActivePerl on Windows, the PPM (Perl Package Manager) has much of the same functionality as CPAN.pm.
Example:
$ ppm
ppm> search net-smtp
ppm> install Net-SMTP-Multipart
see How do I install Perl modules? in the CPAN FAQ
Many distributions ship a lot of perl modules as packages.
Debian/Ubuntu: apt-cache search 'perl$'
Arch Linux: pacman -Ss '^perl-'
Gentoo: category dev-perl
You should always prefer them as you benefit from automatic (security) updates and the ease of removal. This can be pretty tricky with the cpan tool itself.
For Gentoo there's a nice tool called g-cpan which builds/installs the module from CPAN and creates a Gentoo package (ebuild) for you.
Try App::cpanminus:
# cpanm Chocolate::Belgian
It's great for just getting stuff installed. It provides none of the more complex functionality of CPAN or CPANPLUS, so it's easy to use, provided you know which module you want to install. If you haven't already got cpanminus, just type:
# cpan App::cpanminus
to install it.
It is also possible to install it without using cpan at all. The basic bootstrap procedure is,
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
For more information go to the App::cpanminus page and look at the section on installation.
I note some folks suggesting one run cpan under sudo. That used to be necessary to install into the system directory, but modern versions of the CPAN shell allow you to configure it to use sudo just for installing. This is much safer, since it means that tests don't run as root.
If you have an old CPAN shell, simply install the new cpan ("install CPAN") and when you reload the shell, it should prompt you to configure these new directives.
Nowadays, when I'm on a system with an old CPAN, the first thing I do is update the shell and set it up to do this so I can do most of my cpan work as a normal user.
Also, I'd strongly suggest that Windows users investigate strawberry Perl. This is a version of Perl that comes packaged with a pre-configured CPAN shell as well as a compiler. It also includes some hard-to-compile Perl modules with their external C library dependencies, notably XML::Parser. This means that you can do the same thing as every other Perl user when it comes to installing modules, and things tend to "just work" a lot more often.
If you're on Ubuntu and you want to install the pre-packaged perl module (for example, geo::ipfree) try this:
$ apt-cache search perl geo::ipfree
libgeo-ipfree-perl - A look up country of ip address Perl module
$ sudo apt-get install libgeo-ipfree-perl
A couple of people mentioned the cpan utility, but it's more than just starting a shell. Just give it the modules that you want to install and let it do it's work.
$prompt> cpan Foo::Bar
If you don't give it any arguments it starts the CPAN.pm shell. This works on Unix, Mac, and should be just fine on Windows (especially Strawberry Perl).
There are several other things that you can do with the cpan tool as well. Here's a summary of the current features (which might be newer than the one that comes with CPAN.pm and perl):
-a
Creates the CPAN.pm autobundle with CPAN::Shell->autobundle.
-A module [ module ... ]
Shows the primary maintainers for the specified modules
-C module [ module ... ]
Show the Changes files for the specified modules
-D module [ module ... ]
Show the module details. This prints one line for each out-of-date module (meaning,
modules locally installed but have newer versions on CPAN). Each line has three columns:
module name, local version, and CPAN version.
-L author [ author ... ]
List the modules by the specified authors.
-h
Prints a help message.
-O
Show the out-of-date modules.
-r
Recompiles dynamically loaded modules with CPAN::Shell->recompile.
-v
Print the script version and CPAN.pm version.
sudo perl -MCPAN -e 'install Foo'
Also see Yes, even you can use CPAN. It shows how you can use CPAN without having root or sudo access.
Otto made a good suggestion. This works for Debian too, as well as any other Debian derivative. The missing piece is what to do when apt-cache search doesn't find something.
$ sudo apt-get install dh-make-perl build-essential apt-file
$ sudo apt-file update
Then whenever you have a random module you wish to install:
$ cd ~/some/path
$ dh-make-perl --build --cpan Some::Random::Module
$ sudo dpkg -i libsome-random-module-perl-0.01-1_i386.deb
This will give you a deb package that you can install to get Some::Random::Module. One of the big benefits here is man pages and sample scripts in addition to the module itself will be placed in your distro's location of choice. If the distro ever comes out with an official package for a newer version of Some::Random::Module, it will automatically be installed when you apt-get upgrade.
Already answered and accepted answer - but anyway:
IMHO the easiest way installing CPAN modules (on unix like systems, and have no idea about the wondows) is:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
The above is installing the "zero configuration CPAN modules installer" called cpanm. (Can take several minutes to install - don't break the process)
and after - simply:
cpanm Foo
cpanm Module::One
cpanm Another::Module
Many times it does happen that cpan install command fails with the message like
"make test had returned bad status, won't install without force"
In that case following is the way to install the module:
perl -MCPAN -e "CPAN::Shell->force(qw(install Foo::Bar));"
Lots of recommendation for CPAN.pm, which is great, but if you're using Perl 5.10 then you've also got access to CPANPLUS.pm which is like CPAN.pm but better.
And, of course, it's available on CPAN for people still using older versions of Perl. Why not try:
$ cpan CPANPLUS
Use cpan command as cpan Modulename
$ cpan HTML::Parser
To install dependencies automatically follow the below
$ perl -MCPAN -e shell
cpan[1]> o conf prerequisites_policy follow
cpan[2]> o conf commit
exit
I prefer App::cpanminus, it installs dependencies automatically. Just do
$ cpanm HTML::Parser
On ubuntu most perl modules are already packaged, so installing is much faster than most other systems which have to compile.
To install Foo::Bar at a commmand prompt for example usually you just do:
sudo apt-get install libfoo-bar-perl
Sadly not all modules follow that naming convention.
On Fedora Linux or Enterprise Linux, yum also tracks perl library dependencies. So, if the perl module is available, and some rpm package exports that dependency, it will install the right package for you.
yum install 'perl(Chocolate::Belgian)'
(most likely perl-Chocolate-Belgian package, or even ChocolateFactory package)
Even it should work:
cpan -i module_name
2 ways that I know of :
USING PPM :
With Windows (ActivePerl) I've used ppm
from the command line type ppm. At the ppm prompt ...
ppm> install foo
or
ppm> search foo
to get a list of foo modules available. Type help for all the commands
USING CPAN :
you can also use CPAN like this (*nix systems) :
perl -MCPAN -e 'shell'
gets you a prompt
cpan>
at the prompt ...
cpan> install foo (again to install the foo module)
type h to get a list of commands for cpan
On Fedora you can use
# yum install foo
as long as Fedora has an existing package for the module.
Easiest way for me is this:
PERL_MM_USE_DEFAULT=1 perl -MCPAN -e 'install DateTime::TimeZone'
a) automatic recursive dependency detection/resolving/installing
b) it's a shell onliner, good for setup-scripts
If you want to put the new module into a custom location that your cpan shell isn't configured to use, then perhaps, the following will be handy.
#wget <URL to the module.tgz>
##unpack
perl Build.PL
./Build destdir=$HOME install_base=$HOME
./Build destdir=$HOME install_base=$HOME install
Sometimes you can use the yum search foo to search the relative perl module, then use yum install xxx to install.
Secure solution
Many answers mention the use of the cpan utility (which uses CPAN.pm) without a word on security. By default, CPAN 2.27 and earlier configures urllist to use a http URL (namely, http://www.cpan.org/), which allows MITM attacks, thus is insecure. This is what is used to download the CHECKSUMS files, so that it needs to be changed to a secure URL (e.g. https://www.cpan.org/).
So, after running cpan and accepting the default configuration, you need to modify the generated MyConfig.pm file (the full path is output) in the following way. Replace
'urllist' => [q[http://www.cpan.org/]],
by
'urllist' => [q[https://www.cpan.org/]],
Note: https is not sufficient; you also need a web site you can trust. So, be careful if you want to choose some arbitrary mirror.
Then you can use cpan in the usual way.
My bug report on rt.cpan.org about the insecure URL.
Simply executing cpan Foo::Bar on shell would serve the purpose.
Seems like you've already got your answer but I figured I'd chime in. This is what I do in some scripts on an Ubuntu (or debian server)
#!/usr/bin/perl
use warnings;
use strict;
#I've gotten into the habit of setting this on all my scripts, prevents weird path issues if the script is not being run by root
$ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';
#Fill this with the perl modules required for your project
my #perl = qw(LWP::Simple XML::LibXML MIME::Lite DBI DateTime Config::Tiny Proc::ProcessTable);
chomp(my $curl = `which curl`);
if(!$curl){ system('apt-get install curl -y > /dev/null'); }
chomp(my $cpanm = system('/bin/bash', '-c', 'which cpanm &>/dev/null'));
#installs cpanm if missing
if($cpanm){ system('curl -s -L http://cpanmin.us | perl - --sudo App::cpanminus'); }
#loops through required modules and installs them if missing
foreach my $x (#perl){
eval "use $x";
if($#){
system("cpanm $x");
eval "use $x";
}
}
This works well for me, maybe there is something here you can use.
On Windows with the ActiveState distribution of Perl, use the ppm command.

Install Cuda without root

I know that I can install Cuda with the following:
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
chmod +x cuda_7.0.28_linux.run
./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers
cd nvidia_installers
sudo ./NVIDIA-Linux-x86_64-346.46.run
sudo modprobe nvidia
sudo ./cuda-linux64-rel-7.0.28-19326674.run
Just wondering if I can install Cuda without root?
Thanks,
Update The installation UI for 10.1 changed. The following works:
Deselect driver installation (pressing ENTERon it)
Change options -> root install path to a non-sudo directory.
Press A on the line marked with a + to access advanced options. Deselect create symbolic link, and change the toolkit install path.
Now installation should work without root permissions
Thank you very much for the hints in the question! I just want to complete it with an approach that worked for me, also inspired in this gist and that hopefully helps in situations where a valid driver is installed, and installing a more recent CUDA on Linux without root permissions is still needed.
TL;DR: Here are the steps to install CUDA9+CUDNN7 on Debian, and installing a pre-compiled version of TensorFlow1.4 on Python2.7 to test that everything works. Everything without root privileges and via terminal. Should also work for other CUDA, CUDNN, TensorFlow and Python versions on other Linux systems too.
INSTALLATION
Go to NVIDIA's official release web for CUDA (as for Nov. 2017, CUDA9 is out): https://developer.nvidia.com/cuda-downloads.
Under your Linux distro, select the runfile (local)option. Note that the sudo indication present in the installation instructions is deceiving, since it is possible to run this installer without root permissions. On a server, one easy way is to copy the <LINK> of the Download button and, in any location of your home directory, run wget <LINK>. It will download the <INSTALLER> file.
Run chmod +x <INSTALLER> to make it executable, and execute it ./<INSTALLER>.
accept the EULA, say no to driver installation, and enter a <CUDA> location under your home directory to install the toolkit and a <CUDASAMPLES> for the samples.
Not asked here but recommended: Download a compatible CUDNN file from the official web (you need to sign in). In my case, I downloaded the cudnn-9.0-linux-x64-v7.tgz, compatible with CUDA9 into the <CUDNN> folder. Uncompress it: tar -xzvf ....
Optional: compile the samples. cd <CUDASAMPLES> && make. There are some very nice examples there and a very good starting point to write some CUDA scripts of yourself.
(If you did 5.): Copy the required files from <CUDNN> into <CUDA>, and grant reading permission to user (not sure if needed):
cp -P <CUDNN>/cuda/include/cudnn.h <CUDA>/include/
cp -P <CUDNN>/cuda/lib64/libcudnn* <CUDA>/lib64
chmod a+r <CUDA>/include/cudnn.h <CUDA>/lib64/libcudnn*
Add the library to your environment. This is typically done adding this following two lines to your ~/.bashrc file (in this example, the <CUDA> directory was ~/cuda9/:
export PATH=<CUDA>/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<CUDA>/lib64/
FOR QUICK TESTING OR TENSORFLOW USERS
The quickest way to get a TensorFlow compatible with CUDA9 and CUDNN7 (and a very quick way to test this) is to download a precompiled wheel file and install it with pip install <WHEEL>. Most of the versions you need, can be found in mind's repo (thanks a lot guys). A minimal test that confirms that CUDNN is also working involves the use of tf.nn.conv2d:
import tensorflow as tf
x = tf.nn.conv2d(tf.ones([1,1,10,1]), tf.ones([1,5,1,1]), strides=[1, 1, 1, 1], padding='SAME')
with tf.Session() as sess:
sess.run(x) # this should output a tensor of shape (1,1,10,1) with [3,4,5,5,5,5,5,5,4,3]
In my case, the wheel I installed required Intel's MKL library, as explained here. Again, from terminal and without root users, this are the steps I followed to install the library and make TensorFlow find it (reference):
git clone https://github.com/01org/mkl-dnn.git
cd mkl-dnn/scripts && ./prepare_mkl.sh && cd ..
mkdir -p build && cd build
cmake -D CMAKE_INSTALL_PREFIX:PATH=<TARGET_DIR_IN_HOME> ..
make # this takes a while
make doc # do this optionally if you have doxygen
make test # also takes a while
make install # installs into <TARGET_DIR_IN_HOME>
add the following to your ~/.bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<TARGET_DIR_IN_HOME>/lib
Hope this helps!
Andres
You can install using conda with the following command.
conda install -c anaconda cudatoolkit
But you need to have prior accesss to the device(GPU).
EDIT : If you are finding error in anaconda repository then change the repository to conda-forge which is frequently updated.
conda install -c conda-forge cudatoolkit
You can install CUDA and compile programs, but you won't be able to run them for a lack of device access.

How to rebuild a Fedora package with a different compiler?

Similarly to this question ("How can I automatically rebuild a package with a different compiler?" on askubuntu.com), I would like to know how can I automate fetching source and compilation of a C program using Fedora build scripts using a specific, non-default compiler - in my case afl-gcc. I would definitely welcome an example of the pv program, but I would like the solution to work for other packages, like libreoffice as well, with minimal modifications. I would like to achieve something similar to aflize (which is for Debian only right now). I have heard of mock and it would be best if I could use it for that.
I do not know to do it automatically, but manually:
Prepare build environnement
$ rpmdev-setuptree
Download corresonding srpms
$ yumdownloader --source foo
Extract files from SRPMS
$ rpm -i foo*.src.rpm
Replace the compiler used
$ sed -i 's/make all/make CC=afl-gcc all/g' ~/rpmbuild/SPECS/foo.spec
setting CC var your corresponding compiler will do the jobs.
If you use cmake take a look to CMAKE_C_COMPILER
Rebuild
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -ba foo.spec
Generated rpm files are located into ~/rpmbuild/RPMS

how to build grub2 bootloader from it's source and test it with qemu emulator

I want to know how to build grub 2 bootloader from it's source in ubuntu and test it with qemu emulator.
I would also like to change the default background image of grub2 bootloader in the new build?
Is this possible? If yes, how ?
Of course you can.
As shown on the GRUB website, the grub source code is available via git from git.savannah.gnu.org.
Then it is theoretically just a question of
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
However, depending on your platform, grub's default target platform may or may not be what you want. So you will need to decide which firmware platform you want to use in QEMU, which depending on your architecture can be something like
(pc) BIOS
coreboot
(U)EFI
ieee1275 (open firmware)
u-boot
Your mentioning of Ubuntu matches at least 3 possible options from the above, but I'm going to be boring and assume you mean x86_64/amd64. Since you will be running GRUB under QEMU, it does not really matter which of the two likely platforms ("pc" or "efi") your physical computer is running. So let's live a little and go for the (U)EFI variant.
You will need some prerequisites installed before configuring and building, so
$ sudo apt-get install build-essential autoconf automake
$ sudo apt-get build-dep grub-efi-amd64
So a practical build may look a bit like this:
$ # Next command is optionnal (languages):
$ ./linguas.sh
$ ./autogen.sh
$ # Next parameters are optionnal:
$ ./configure --prefix=$HOME/local --platform=efi
$ make
$ # Next command is optionnal:
$ make check
$ make install
The easiest way to get a functioning GRUB image is probably with the grub-mkstandalone command:
$ $HOME/local/bin/grub-mkstandalone -O x86_64-efi -o mygrub.efi
Note: To install grub on /dev/sda disk (instead of QEMU), use:
$ sudo grub-install /dev/sda
Note: If you don't see GRUB menu when booting, check this question. It involves pressing Shift when booting or editing /etc/default/grub to comment GRUB_HIDDEN_TIMEOUT.
Then you need some kind of UEFI image to run under your QEMU. The default choice for x86 is called OVMF and is part of Tianocore EDK2 - the de facto open source implementation of UEFI. Due to legal technicalities with regards to redistribution of the FAT filesystem driver, many Linux distributions (including Ubuntu) do not include a pre-built one. But have no fear, it is pretty straightforward to build one yourself.
However, I am not going to take this answer further off-topic than I already have, so all I am going to say is have a read through the OVMF README and look through one or two only slightly outdated blog posts about it.

Installing and Configuring Mercurial on Jenkins application -OpenShift

Any hints on how doing this? I tried with the auto-install from a downloaded zip from this here, extracted here: OPENSHIFT_DATA_DIR/hg and executable location here: OPENSHIFT_DATA_DIR/jenkins/data/tools/Mercurial/mercurial-2.2.1/bin/hg
I'm doing something wrong for sure, I'm not Linux saavy. Jenkins says is unable to find mercurial executable.
Any help is more than welcomed.
Here's the answer from here:
Thanks for the email discussion.
Mercurial includes a README which explains a couple of modes of execution:
Basic install:
$ make # see install targets
$ make install # do a system-wide install
$ hg debuginstall # sanity-check setup
$ hg # see help
Running without installing:
$ make local # build for inplace usage
$ ./hg --version # should show the latest version
"make install" will not work as it attempts to do a system-wide install. The user on the gears will not have access to write to system files.
"make install-home" will not work either.
"make local" works and will install it in cwd such that running the following will should work just fine:
./hg --version
Mercurial Distributed SCM (version 2.2.1)
(see http://mercurial.selenic.com for more information)