How to install pdftk on Amazon Linux AMI release 2012.03 - amazon

I am not able to install the pdftk on Amazon Linux AMI release 2012.03. pdftk requires gcj2.14 and amazon ami provides gcj2.12 package. If I try to install gcj2.14 getting conflicts with the existing gcj package. Please suggest a way to install pdftk without any need to upgrade amazon ami linux as my application is already setup and running there.
Your help will be appreciated

Inspired by #marcus and his github repo, I just did this:
sudo wget -O /usr/lib64/libgcj.so.10 https://github.com/lob/lambda-pdftk-example/raw/master/bin/libgcj.so.10
sudo wget -O /usr/bin/pdftk https://github.com/lob/lambda-pdftk-example/raw/master/bin/pdftk
chmod a+x /usr/bin/pdftk
Works like a charm.

As you probably don't want to pollute your production image with all dependencies pdftk requires - one way is to build pdftk somewhere else and deploy it to e.g. through S3.
Following is steps should get you started. Copy and paste from history so should show steps needed.
Pick up RedHat instance from AWS (or local Centos 6)
sudo su -
yum install gcc
yum install gcc-java
yum install gcc-c++
cd /tmp/
wget http://pkgs.repoforge.org/pdftk/pdftk-1.44-2.rf.src.rpm
rpm2cpio pdftk-1.44-2.rf.src.rpm | cpio -idmv
unzip pdftk-1.44-src.zip
cd pdftk-1.44-dist/
cd pdftk
make -f Makefile.Redhat
find / -iname libgcj.so.10.0.0
mkdir -p /tmp/pdftk
cp pdftk /tmp/pdftk
find / -iname libgcj.so.10.0.0
cp /usr/lib64/libgcj.so.10.0.0 /tmp/pdftk
cd /tmp/
tar cvzf pdftk.tar.gz pdftk
Make sure you copy tar package content in target machine (Linux AMI) as follows
libgcj.so.10.0.0 install to /usr/lib64
ls -alh /usr/lib64/libgcj.so.*
lrwxrwxrwx 1 root root 27 Sep 6 06:39 /usr/lib64/libgcj.so.10 -> /usr/lib64/libgcj.so.10.0.0
-rwxr-xr-x 1 root root 47M Sep 6 06:38 /usr/lib64/libgcj.so.10.0.0
I just used to S3 bucket to transfer file:
/usr/bin/s3cmd --force get s3://<your-bucket>/rpm/pdftk.tar.gz /tmp/
pushd /tmp
/bin/tar xzf pdftk.tar.gz
/bin/cp pdftk/pdftk /usr/bin/
/bin/cp pdftk/libgcj.so.10.0.0 /usr/lib64/libgcj.so.10.0.0
/bin/ln -s /usr/lib64/libgcj.so.10.0.0 /usr/lib64/libgcj.so.10.0
/sbin/ldconfig
popd

Very old post, but I've been looking into ways to get pdftk installed on the Amazon distro (which is what the OP is using). Here's a response from an Amazon rep:
GCJ is not supported on the Amazon Linux AMI, which is why you are
running into this problem.
In the interest of getting you moving forward as quickly as possible
on an EC2 instance that is RPM based, I'd recommend that you give
Fedora a try, because pdftk is packaged in their repositories.
Thank you for using EC2, and I hope this suggestion helps you out.
https://forums.aws.amazon.com/thread.jspa?threadID=96919

Related

nodejs/bin/node does't exists when truing to install node.js on server

I have shaed hosting on siteground , basically my server runs PHP , but i also wanted to run node on my server , so i ssh'ed using putty and ran the following commands:
curl http:// nodejs.org/dist/latest/node-v8.11.3-linux-x64.tar.xz Then unzipped it.
mv node-v8.11.3-linux-x64/ nodejs.
mkdir ~/bin
cp nodejs/bin/node ~/bin
The last command throws an error
cp: connot stat nodejs/bin/node: no such file or directory exists
I was basically trying to follow the tutorial on HERE.
Follow this guide instead, it's from the actual node GitHub instead of a Medium article: How to install Node.js via binary archive on Linux?.
You are going to need 3 specific programs:
curl to download stuff
tar to deal with tar files
xz to deal with zip compression
Make sure all of those are installed using (and this assumes you're using Ubuntu or a distro that leverages apt):
sudo apt-get update && sudo apt-get install -y curl tar xz-utils
After that do something a little bit different from the tutorial
Download and save the archive:
curl -O https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.xz
Untar the archive:
tar xf node-v8.11.3-linux-x64.tar.xz
Make a nodejs directory to organize your versions:
mkdir /usr/local/lib/nodejs
Move the unarchived folder to your /usr/local/lib/nodejs folder:
mv node-v8.11.3-linux-x64 /usr/local/lib/nodejs/
Symlink node and npm into the /usr/bin/ folder:
ln -s /usr/local/lib/nodejs/node-v8.11.3-linux-x64/bin/node /usr/bin/node
ln -s /usr/local/lib/nodejs/node-v8.11.3-linux-x64/bin/npm /usr/bin/npm
Make sure everything is working:
node -v
npm -v

Installing a tar.gz on Linux

I have downloaded Node.js from this link, which points to this link when clicking the button:
https://nodejs.org/dist/v4.1.2/node-v4.1.2-linux-x64.tar.gz
As advice from the Ubuntu community on installing the tar.gz, the following steps are followed.
$ ./configure
$ make
$ [sudo] make install
The problem is the current file I have downloaded does not contain ./configure.
So how do I install this? Should I extract this to the usr/ folder?
My OS is Debian 8 (Jessie).
Should I include the Java package from Oracle? Is it safe to extract these files to the /usr folder?
You can download this file from the browser or from the console. The latter is shown below (note: the specific Node.js version might be different for you):
Example :
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
sudo tar -C /usr/local --strip-components 1 -xzf node-v8.1.1-linux-x64.tar.gz
#tar options:
-x, --extract, --get
extract files from an archive
-f, --file ARCHIVE
use archive file or device ARCHIVE
-z, --gzip, --gunzip --ungzip`
You may find list of node version on http://nodejs.org/dist/
You should now have both Node.js and npm installed in “/usr/local/bin”. You can check this typing:
ls -l /usr/local/bin/node ls -l /usr/local/bin/npm
*An alternative way to install Node.js via the package manager:
Installing Node.js via package manager
Download the .tar.xz file form https://nodejs.org/en/ and then press Ctrl + Alt + T.
Then go to the destination that you downloaded your file to. For me it's my downloads folder. Then hit this command and Node.js will get installed on your system:
sudo tar -xf node-v16.0.0-linux-x64.tar.xz --directory=/usr/local --strip-components=1
This was the answer I had posted over two years ago, and here is what I recommand you right now, decompress the tarball, and keep it anywhere where your system knows ( tell it via updating $PATH ), its just a binary file, its not necessary to keep it in some specific location, you can keep it in your home directory and andd your bin folder to your bashrc or whatever shell you are using, its .rc file, and it will work just fine, at the end of the day, its just a pre-compiled binary file (inside node) nothing much.
Somebody in the comment section was saying npm, needs to be installed sepretly, this was in the early days of node back in 2012, when npm used to not ship with node, if you look inside bin folder npm binary is also there, so you dont need to install npm sepretly.
In case of installing from source code, you must download source code from https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz.
The file ending with .tar.gz is the compressed file like zip file, and you should extract the file before you can do another operation.
You can extract this file anywhere you need. In the terminal, change the location to your .tar.gz file:
$ cd /path/to/tar.gz/file
Then extract it using tar:
$ tar xvzf node-v4.1.2.tar.gz
Then change the location to the extracted directory
$ cd node-v4.1.2
After this, you can run .configure and 'make' it:
$ ./configure
$ make
$ [sudo] make install
Using the make utility is only necessary if you're compiling software. However, the tarballs provided by nodejs.org contain compiled binaries, not source code. Really you don't need to install it to use.
You can simply cd into the bin directory and run it via ./node. Though I'll say it's pretty useful to have it in your PATH. Where you put this directory doesn't really matter.
If you're installing it locally on your own machine, you can just untar it, tar xvfz node*tar.gz, to your home directory, add this to the file ~/.bashrc, and append the directory path your your PATH environment variable like so PATH=$PATH:/home/USERNAME/DIRECTORY/bin. Just change the path to the exact path to the bin folder in the directory you extracted.
You can also add these files to a directory that's already in your path, such as /usr/share or /usr/local by simple copying the files from the archive into these folders, as they share the same structure.
Run the following commands where your ta.xz file (no need for extraction) file is located in the terminal. NB: I used Kali Linux
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-v14.4.0-linux-x64.tar.xz -C /usr/local/lib/nodejs
export PATH=/usr/local/lib/nodejs/node-node-v14.4.0-linux-x64/bin:$PATH
You can now check npm -v, node -v, and npx -v.
STEP 1:
Download your version of Node.js from the Node.js website or use the below command with your version:
wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz
You will get a Node.js file tar file after the above step.
STEP 2:
Just use the below command for installation
sudo tar -C /usr/local --strip-components 1 -xvf node-v8.1.1-linux-x64.tar.gz
I am mentioning version-specific installation of NVM and Node.js.
If you don't have brew installed, run this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If you don't have wget installed, run this:
brew install wget
To install Node.js of a specific version, run these commands: Here, I'm installing NVM - v0.33.1 and Node.js of v0.12.6.
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
source ~/.bashrc
nvm install v0.12.6
command -v nvm //verify install
You can do some this:
# Using Ubuntu or Debian
curl -sL https://deb.nodesource.com/setup_[version].x | sudo -E bash -
sudo apt-get install -y nodejs
Where [version] must be replaced for your version of Node.js that you required install
For example, I required to install Node.js v.12
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Download a suitable installation from
https://nodejs.org/en/download/
Incase of CentOS
Go to the downloaded file location
Execute the following
sudo tar -C /usr/local --strip-components 1 -xf "name of the tar.xz downloaded"
Check the installed version is correct
node --version
The given solution is correct, but it works for the source file and not the Linux distribution link used in the question above.
$ ./configure
$ make
$ [sudo] make install
The correct link is: https://nodejs.org/dist/v8.11.2/node-v8.11.2.tar.gz and we can use the above steps after downloading and extracting this file.
Download the latest version of Node.js from the official site, https://nodejs.org/en/
Steps to install:
Extract to any of the directories where you wish to install Node.js using a command or archive manager window
Open the terminal
Run '$sudo su'
Being superuser and open the profile file using 'nano ~/.profile'
At the end of the file, add:
# Node.js
export PATH=/path-to-bin.executable:$PATH
The path to bin application located within the bin folder of Node.js extracted folder is to be pasted in the above line
Save using Ctrl + O then come out by Ctrl + X
Refresh profile by the command '.~/.profile'
Come out of superuser by the 'exit' command
Again for normal users, use 'sudo'
'sudo nano ~/.profile'
Add the line at the end:
# Node.js
export PATH=/path-to-bin.executable:$PATH
Same as in step 5
Save and exit
Here the refresh command as above won't work, so restart the system to finish installation correctly
To get the version, issue 'node -v'

How do I install PDFTK on VPS for cPanel or CentOS?

I tried using the following commands. However when I reach the last step to install pdftk the console is giving me the error below. I am using a hostgator VPS server. any possible suggestions would be great.
NB: I tried installing libgcj.so.7rh()(64bit) but it already exists. maybe I am doing something wrong.
**Error:** Package: pdftk-1.44-2.el5.rf.x86_64 (rpmforge)
Requires: libgcj.so.7rh()(64bit)
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
sendmail-cf-8.14.4-8.el6.noarch has missing requires of sendmail = ('0', '8.14.4', '8.el6')
These are the steps that I followed.
# Log in as root
cd /usr/local/src
# Type
uname -i
#To see which package you need
#Pick one of the below vdepending on the output of uname -i
i386<br>
wegt packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64 <br>
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
#Then type
rpm --import apt.sw.be/RPM-GPG-KEY.dag.txt
Verify the downloaded package
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Install RPM
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
#Then
yum install pdftk
Note: I had to remove the http:// from the links in the commands above before posting.
It seems like you might have a 32-bit OS installed? If you ran through each of those commands in order, you would be trying to use the 64-bit rpmforge repository, which is incorrect for a 32-bit OS.
If that is an accurate supposition, do this..
cd /etc/yum.repos.d/
ls -al
rm <each-rpmforge-file>
Then...
cd /usr/local/src
yum clean
wget packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
yum update
yum install pdftk

selecting an AMI for deploying a haskell app?

I'm working on a haskell web app using yesod that I eventually want to deploy to EC2, can someone recommend an AMI that has a recent haskell platform and a git client install-able from the repositories?
If you look at Michael Snoyman's setup script here, it contains the steps he used to get an EC2 instance going on a Ubuntu AMI.
https://github.com/yesodweb/benchmarks/blob/master/setup.sh
I also have Yesod running from source on Amazon Linux. It takes a few hours to build everything but I think any of the standard boxes with at least 8G of memory should do it (otherwise GHC can't link). This is how I did it:
# install what packages are available
sudo yum --enablerepo=epel install haskell-platform git make ncurses-devel patch
# make and install ghc
wget http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-src.tar.bz2
tar jxf ghc-7.0.4-src.tar.bz2
rm ghc-7.0.4-src.tar.bz2
cd ghc-7.0.4
./configure
make -j 4
# wait a few hours
sudo make install
cd
rm -rf ghc-7.0.4
# make and install haskell-platform
wget http://lambda.haskell.org/platform/download/2011.4.0.0/haskell-platform-2011.4.0.0.tar.gz
tar zxf haskell-platform-2011.4.0.0.tar.gz
cd haskell-platform-2011.4.0.0
./configure
make -j 4
sudo make install
cd
rm -rf haskell-platform-2011.4.0.0
You shouldn't compile on an EC2 instance. Choose a generic AMI like Ubuntu, and perform the compile on a local computer, then upload the static binary to EC2.

Install Icecast into Linux

I have no experience to linux system, and i would like to help me to solve this issue..
Now i have the following job..
cd ~
cd home
cd myusernmae
mkdir src
wget http://downloads.xiph.org/releases/icecast/icecast-2.3.2.tar.gz
tar -zxvf icecast-2.3.2.tar.gz
cd icecast-2.3.2
./configure
Error so i type the followings
apt-get install libxslt1-dev
sudo apt-get install libogg-dev libvorbis-dev
./configure
make
make install
cp -R /home/username/icecast-2.3.2/web ~/icecast/
Now when i type icecast shell response with the following message
Icecast 2.3.2
usage: icecast [-b -v] -c <file>
options:
-c <file> Specify configuration file
-v Display version info
-b Run icecast in the background
I know how can i use icecast into windows (icecast configuration file) but i don't know where to find it and how modify it into linux (vi editor :( )
Any help would me usefull
If this is an Ubuntu or a Debian based system, a simple sudo apt-get install icecast2 should install the server for you without polluting your system. The configuration file is usually in /etc/. If it is Debian or Ubuntu, doing a dpkg -L icecast2 | grep etc after installing should show you the config files. Fire up an editor, edit them and then restart the service.

Resources