installing ghostscript with vagrant - vagrant

I would like to install ghostscript when creating my vagrant environment but i have no idea how to achieve this. My provisioning script looks as following:
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
sudo apt-get install -y wget php5 apache2
# Apache stuff
sudo a2enmod rewrite
rm -rf /var/www
ln -fs /vagrant /var/www
sudo service apache2 restart

Inside your shell provisioning script you must define the following commands
wget http://downloads.ghostscript.com/public/ghostscript-9.10.tar.bz2
tar xjf ghostscript-9.10.tar.bz2
cd ghostscript-9.10
rm -rf zlib && ./configure --prefix=/usr --disable-compile-inits \ --enable-dynamic --with-system-libtiff && make
make so
su root
make install
gs -v
What this basically does is:
download the package
extract the contents
compiles ghostscript
installs ghostscript
checks if it installed correctly
Above explanation has to send you on it's way to install it

Related

How do I merge 2 directories with the same name in shell script

I am programming something and one of the things I need to do is to merge 2 directories. How do I do that? Rsync does not work. I tried compiling but after a few seconds it gave me errors.
These are the commands I ran (I ran these because the INSTALL.md said so):
sudo apt install -y gcc g++ gawk autoconf automake python3-cmarkgfm
sudo apt install -y acl libacl1-dev
sudo apt install -y attr libattr1-dev
sudo apt install -y libxxhash-dev
sudo apt install -y libzstd-dev
sudo apt install -y liblz4-dev
sudo apt install -y libssl-dev
./configure
make
sudo make install
a simple and efficient way is with cp
cp --force --archive --update --link ./img1/. ./img2
copy all files of ./img1 directory to ./img2 directory and replaces older items.
the --link option is for merging directories without moving any data.

launch basic bash script on docker build from windows system

I would like to construct a docker image based from script bash for provisioning my system.
I try to build my image and docker tell me "Successfully built" but when I try to launch this I can see this message : "No such file or directory" and I can't viewing container in Kitematic application.
If I launch docker inspect on my container (created correctly but not launched) I can view a ExitCode 127.
Can you help me to understand issue and also help me to launch correctly a simple script bash for provisionning image docker.
dockerfile :
FROM ubuntu:trusty
MAINTAINER barbie rambo <barbierambo#mymail.com>
RUN apt-get update \
&& apt-get install -y openjdk-7-jdk wget openssh-server tar vim
COPY scripts/base.sh /home/docker/scripts/base.sh
RUN chmod 744 /home/docker/scripts/base.sh
ENTRYPOINT /home/docker/scripts/base.sh
my base.sh script
#!/usr/bin/env bash
# Set non-interactive mode
#export DEBIAN_FRONTEND=noninteractive
# Update the box
apt-get -y update
apt-get -y install linux-headers-$(uname -r) build-essential
apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev
apt-get -y install curl unzip
apt-get -y install software-properties-common
apt-get -y install gnupg2
# others tools
sudo apt-get -y install nano
sudo apt-get -y install vim
sudo apt-get -y install aptitude
sudo apt-get -y install git
sudo apt-get -y install openjdk-8-jre
sudo apt-get -y install whois
sudo apt-get -y install dos2unix
check whether /home/docker/scripts/base.sh has EOL as UNIX/OSX Format, if not you can do EOL Conversion in Notepad++
open file in Notepad++ -> Edit -> EOL Conversion -> UNIX/OSX Format -> Save
then rebuild docker image
If you want to get into container ten run following:
docker ps -a
and use container id
docker exec -i -t [containerID] bash
and check whether file /home/docker/scripts/base.sh exists

Error in build from Dockerfile for Ubuntu image with Mono installed

I have the following docker file that I am attempting to use to build a Ubuntu image with mono.
FROM ubuntu:14.04
MAINTAINER John Smith <John.Smith#gmail.com>
RUN sudo apt-get update
RUN sudo /bin/bash -l -c apt-get install wget
RUN sudo /bin/bash -l -c apt-get http://download.mono-project.com/repo/xamarin.gpg
RUN sudo apt-key add xamarin.gpg
RUN sudo echo "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list
RUN sudo apt-get update
RUN sudo apt-get install mono-complete
When I run the following docker build command...
docker build -t="test/mono" .
It fails building and gives the following errors message:
gpg:can't open 'xamaring.gpg': No such file or directory.
2015/05/27 16:11:01 The command [/bin/bash -c sudo apt-key add xamarin.gpg] returned a non-zero code: 2
Anything obviously wrong sticking out?
It looks like you forgot to use wget instead of apt-get after you installed wget, so 'xamaring.gpg' has not been downloaded and that's why it can't be found.
You need this:
/bin/bash -l -c "wget http://download.mono-project.com/repo/xamarin.gpg"
The is an example of this in docker's website:
Dockerizing MongoDB

Automate nginx installation via passenger

Every time we reinstall nginx using passenger, we have to provide to it a bunch of options to define the paths, modules and options we'd like to activate, which can be a bit of pain.
Does anybody know of a way to automate this using some kind of answer file?
Yes you can use a provisioning tool like Chef or Puppet but in some cases those can be overkill. I just have a Bash script with some variables at the top that get changed as necessary, I then just transfer the script to the target server and execute it.
The actual packages for nginx & passenger I keep in my own S3 bucket.
#!/bin/sh
# setup download location
DOWNLOAD_DIR=/tmp
NGINX="nginx-1.4.1"
NGINX_DIR=${DOWNLOAD_DIR}/${NGINX}
PASSENGER_VERSION="4.0.3"
S3HOST="your-s3-host"
# download nginx source
curl http://${S3HOST}.s3.amazonaws.com/software/${NGINX}.tar.gz -o $DOWNLOAD_DIR/${NGINX}.tar.gz
tar xzf $DOWNLOAD_DIR/${NGINX}.tar.gz --directory $DOWNLOAD_DIR
# download headers module
curl http://${S3HOST}.s3.amazonaws.com/software/headers-more-nginx-module-v0.16.zip -o $DOWNLOAD_DIR/headers-more-nginx-module-v0.16.zip
unzip $DOWNLOAD_DIR/headers-more-nginx-module-v0.16.zip -d $DOWNLOAD_DIR
# install passenger
apt-get install -y gcc g++ build-essential bison openssl libreadline6 lsof
apt-get install -y libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libpcre3-dev
apt-get install -y libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libcurl4-openssl-dev
apt-get install -y default-jre python-software-properties imagemagick
apt-get install -y ruby1.9.3 ruby1.9.1-dev libruby1.9.1 rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 s3cmd
ln -nfs /var/lib/gems/1.9.1/bin/* /usr/bin/
gem install passenger -v ${PASSENGER_VERSION} --no-ri --no-rdoc
gem install bundler sass --no-ri --no-rdoc
# postgres client libraries
aptitude install software-properties-common -y
add-apt-repository -y ppa:pitti/postgresql
apt-get update
apt-get install -y postgresql-client-9.2 postgresql-server-dev-9.2
wget http://${S3HOST}.s3.amazonaws.com/software/passenger-enterprise-server-${PASSENGER_VERSION}.gem
gem install ./passenger-enterprise-server-${PASSENGER_VERSION}.gem --no-ri --no-rdoc
/var/lib/gems/1.9.1/gems/passenger-enterprise-server-${PASSENGER_VERSION}/bin/passenger-install-nginx-module \
--auto --prefix=/usr --nginx-source-dir=${NGINX_DIR} \
--extra-configure-flags="--conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-md5-asm --with-md5=/usr/include --with-sha1-asm --with-sha1=/usr/include --without-http_fastcgi_module --with-http_stub_status_module --with-http_ssl_module --add-module=${DOWNLOAD_DIR}/headers-more-nginx-module-v0.16"
# make proper folders
mkdir -p /etc/nginx/sites-enabled
mkdir -p /etc/nginx/conf.d
mkdir -p /var/tmp/nginx
mkdir -p /etc/nginx/ssl/rapidssl
mkdir -p /var/www/shared/log/old_logs
chown -R vino:vino /var/www
# cleanup the stupid files
rm /etc/nginx/*.default
# start from init script
update-rc.d nginx defaults
# cleanup
rm -rf $DOWNLOAD_DIR/nginx*
passenger-install-apache2-module supports non-interactive, automatic, headless installs or upgrades through command line options. You can use those options to automate answers. This is documented in the manual: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_non_interactive_automatic_headless_installs_or_upgrades
Alternatively, you can install Phusion Passenger as if it's a normal Nginx module, and use the normal Nginx installation automation scripts: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_as_a_normal_nginx_module_without_using_the_installer
You could use a provisioning tool such as chef or puppet. It may be overkill to use it for this case on its own, but you could use it to prepare entire servers or workstations from the ground up.

how to install apt-get, raspbian

I am doing host target development within scratchbox. And apt-get is not installed in my target raspbian rootfile system.
What is the right apt-get package to use from here for raspbian ?
http://www.apt-get.org/main/
Should i use wget command for .deb package of apt-get ?
http://www.cyberciti.biz/tips/linux-wget-your-ultimate-command-line-downloader.html
http://www.thegeekstuff.com/2009/09/the-ultimate-wget-download-guide-with-15-awesome-examples/#more-1885
dpkg is installed in root filesystem of my target, i have checked it using whereis command
Please suggest, or can you suggest some link for installing apt-get itself. I am not able to find something related to it.
Any reply will be appreciable.
Looks like maybe debian apt package will get you there. I thought apt was just ubuntu but no.
The Raspbian FAQ is here: http://www.raspbian.org/RaspbianFAQ
In it you can grab a list of apps included in Rasbian:
http://archive.raspbian.org/raspbian/dists/wheezy/main/binary-armhf/Packages
You can grab the Raspbian package archive here:
http://archive.raspbian.org/raspbian/dists/wheezy/main/binary-armhf/Packages.gz
Extract it, then use dpkg to install apt-get.
Install Putty.exe and login with putty to your raspbian with ip-adress of your raspbian and you can install apt-get!
Install the following:
sudo apt-get update;
sudo apt-get install gcc;
sudo apt-get install autoconf;
sudo apt-get install libtool;
sudo apt-get install pkg-config;
sudo apt-get install libselinux1-dev;
sudo apt-get install liblockdev1-dev;
sudo apt-get install gawk;
sudo apt-get install g++;
sudo apt-get install c++;
sudo apt-get install libgudev-1.0-dev;
sudo apt-get install libudev-dev;
mkdir -p $HOME/distr/libcec;
wget -P $HOME/distr/libcec https://github.com/Pulse-Eight/libcec/archive/master.zip;
unzip $HOME/distr/libcec/master.zip -d $HOME/distr/libcec/;
cd $HOME/distr/libcec/libcec-master ./bootstrap;"
./configure --with-rpi-include-path=/opt/vc/include --with-rpi-lib-path=/opt/vc/lib --enable-rpi;
make;
sudo make install;
sudo apt-get install cec-utils;
sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot
After the reboot, is everything up-to-date and you have no problems anymore!

Resources