What I did:
Login into Linux m/c
run command: su
run command: wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz
run command: gzip –d openssl-1.0.1c.tar.gz
run command: tar -xvf openssl-1.1.0c.tar.gz
run command: cd openssl-1.1.0c
run command: ./config shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
run command: gmake clean depend
run command: gmake
run command: gmake install
run command: cd /usr/local/ssl/bin
run command: ./openssl version
Expected result: OpenSSL 1.1.0c 10 Nov 2016
Actual result: OpenSSL 0.9.8j-fips 07 Jan 2009
Why is the OpenSSL is showing different version? and how to fix this?
Related
I am attempting to create a launch template in aws with the following in the user data
#!/bin/bash
home=/home/ec2-user
nodev='8.11.2'
nvmv='0.33.11'
#install node
su - ec2-user -c "curl
https://raw.githubusercontent.com/creationix/nvm/v${nvmv}/install.sh | bash"
su - ec2-user -c "nvm install ${nodev}"
su - ec2-user -c "nvm use ${nodev}"
# install git
yum install git -y
#clone the code
cd /home/ec2-user
su - ec2-user -c "git clone https://github.com/xyz/xdf.git"
cd /home/ec2-user/xdf
#install dependencies
su - ec2-user -c "npm install"
echo "test" > test.txt
#install pm2
su - ec2-user -c "npm install pm2 -g"
#run the server
su - ec2-user -c "pm2 run index.js"
The script is being executed and the repo is cloned but the npm install command is running on the dir /home/ec2-user rather than on /home/ec2-user/xdf. The test.txt is created in the correct place ie inside /home/ec2-user/xdf. How do I get npm install to run on /home/ec2-user/xdf. I tried just running npm install instead of su - ec2-user -c "npm install", but it still giving the same results.
First of all userdata is running with root user permissions so you don't need to have sudo or su there. In case you want ec2-user to be owner of that dir so simply execute chown ec2-user:ec2-user /path/to/dir
Next, when you run su - ec2-user -c ... it is executed in /home/ec2-user dir and cd /home/ec2-user/xdf is not working here.
Simply remove all su from your script
I have an AutoScaling group on Amazon AWS.
It works perfectly apart from one thing. When userdata bootstrap script is executed it runs as root user and my pm2 process is running with ubuntu user.
Even if I switch user in the script it still says pm2 command not found
//RESPONSE in /var/log/cloud-init-output.log
//Here is the response
Already up to date.
ubuntu
v8.10.0
bash: npm: command not found
From https://bitbucket.org/repo
* branch HEAD -> FETCH_HEAD
Already up to date.
bash: pm2: command not found
Even node version in AMI is 10.15.1 but it prints 8.10.0
Here is my bootstrap script
#!/bin/bash
cd /pathtodirectory
git pull repo
cd ..
sudo touch yesiran
cd folder
su ubuntu bash -c "whoami"
su ubuntu bash -c "git config --global core.mergeoptions --no-edit"
su ubuntu bash -c "node -v"
su ubuntu bash -c "npm -v"
su ubuntu bash -c "pm2 reload all"
I'm trying to deploy a geodjango application on AWS Elastic Beanstalk. The configuration is 64bit Amazon Linux 2017.09 v2.6.6 running Python 3.6. I am getting this error when trying to deploy:
Requires: libpoppler.so.5()(64bit) Error: Package: gdal-java-1.9.2-8.rhel6.x86_64 (pgdg93) Requires: libpoppler.so.5()(64bit)
How do I install the required package? I read through Setting up Django with GeoDjango Support in AWS Beanstalk or EC2 Instance but I am still getting problems. My ebextensions currently looks like:
commands:
01_yum_update:
command: sudo yum -y update
02_epel_repo:
command: sudo yum-config-manager -y --enable epel
03_install_gdal_packages:
command: sudo yum -y install gdal gdal-devel
packages:
yum:
git: []
postgresql95-devel: []
gettext: []
libjpeg-turbo-devel: []
libffi-devel: []
I'm going to answer my own question for the sake my future projects and anyone else trying to get started with geodjango. Updating this answer as of July 2020
Create an ebextensions file to install GDAL on the EC2 instance at deployment:
01_gdal.config
commands:
01_install_gdal:
test: "[ ! -d /usr/local/gdal ]"
command: "/tmp/gdal_install.sh"
files:
"/tmp/gdal_install.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
# Geos
cd /
sudo mkdir -p /usr/local/geos
cd usr/local/geos/geos-3.7.2
sudo wget geos-3.7.2.tar.bz2 http://download.osgeo.org/geos/geos-3.7.2.tar.bz2
sudo tar -xvf geos-3.7.2.tar.bz2
cd geos-3.7.2
sudo ./configure
sudo make
sudo make install
sudo ldconfig
# Proj4
cd /
sudo mkdir -p /usr/local/proj
cd usr/local/proj
sudo wget -O proj-5.2.0.tar.gz http://download.osgeo.org/proj/proj-5.2.0.tar.gz
sudo wget -O proj-datumgrid-1.8.tar.gz http://download.osgeo.org/proj/proj-datumgrid-1.8.tar.gz
sudo tar xvf proj-5.2.0.tar.gz
sudo tar xvf proj-datumgrid-1.8.tar.gz
cd proj-5.2.0
sudo ./configure
sudo make
sudo make install
sudo ldconfig
# GDAL
cd /
sudo mkdir -p /usr/local/gdal
cd usr/local/gdal
sudo wget -O gdal-2.4.4.tar.gz http://download.osgeo.org/gdal/2.4.4/gdal-2.4.4.tar.gz
sudo tar xvf gdal-2.4.4.tar.gz
cd gdal-2.4.4
sudo ./configure
sudo make
sudo make install
sudo ldconfig
As shown, the script checks whether gdal already exists using the test function. It then downloads the Geos, Proj, and GDAL libraries and installs them in the usr/local directory. At the time of writing this, geodjango (Django 3.0) supports up to Geos 3.7, Proj 5.2 (which also requires projdatum. Current releases do not require it), and GDAL 2.4 Warning: this installation process can take a long time. Also I am not a Linux professional so some of those commands may be redundant, but it works.
Lastly I add the following two environment variables to my Elastic Beanstalk configuration:
LD_LIBRARY_PATH: /usr/local/lib:$LD_LIBRARY_PATH
PROJ_LIB: usr/local/proj
If you still have troubles I recommend checking the logs and ssh-ing in the EC2 instance to check that installation took place. Original credit to this post
So I have the following Dockerfile:
############################################################
# Based on Ubuntu
############################################################
FROM ubuntu:trusty
MAINTAINER OTIS WRIGHT
# Add extra software sources
RUN apt-get update -qq
# Libsass requirements.
RUN apt-get install -y curl git build-essential automake libtool
# Fetch sources
RUN git clone https://github.com/sass/libsass.git
RUN git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
RUN cd libsass
RUN autoreconf --force --install
RUN cd ..
# Create custom makefiles for **shared library**, for more info read:
# 'Difference between static and shared libraries?' before installing libsass http://stackoverflow.com/q/2649334/802365
RUN cd libsass
RUN autoreconf --force --install
RUN ./configure --disable-tests --enable-shared --prefix=/usr
RUN cd ..
# Build the library
RUN make -C libsass -j5
# Install the library
RUN make -C libsass -j5 install
I am trying to build libsass based on this gist:
https://gist.github.com/edouard-lopez/503d40a5c1a49cf8ae87
However when I try to build with docker I get the following error:
Step 11 : RUN git clone https://github.com/sass/libsass.git
---> Using cache
---> d1a4eef78fa5
Step 12 : RUN git clone https://github.com/sass/sassc.git libsass/sassc
---> Using cache
---> 435410579641
Step 13 : RUN cd libsass
---> Using cache
---> f0a4df503d85
Step 14 : RUN autoreconf --force --install
---> Running in a9b0d51d6ee3
autoreconf: 'configure.ac' or 'configure.in' is required
The command '/bin/sh -c autoreconf --force --install' returned a non-zero code: 1
I don't know a lot about compiling from source so any solutions please walk me through.
Docker won't change dirs for you RUN cd libsass so you need to path your commands or use the WORKDIR directive
I have a simple Dockerfile that downloads the node.js source tarball, checksums it, extracts it, builds and installs it. The checksum works when manually run in an interactive docker container, but fails when running the exact same commands when building a Dockerfile.
Works:
docker run -i -t ubuntu:12.04 /bin/bash
cd /tmp
apt-get update -y
apt-get install wget build-essential automake -y
wget http://nodejs.org/dist/latest/node-v0.10.26.tar.gz
wget http://nodejs.org/dist/latest/SHASUMS256.txt
sha256sum -c SHASUM256.txt 2>&1|grep -qs OK
tar -xvf node-v0.10.26.tar.gz && cd node-v0.10.26
./configure && make && make install
Doesn't work:
sudo docker build -t="my_docker_node_image_01" .
Error is:
sudo docker build -t="my_docker_node_image_01" .
Uploading context 7.168 kB
Uploading context
Step 0 : FROM ubuntu:12.04
---> 9cd978db300e
Step 1 : RUN cd /tmp
---> Using cache
---> 0467ad75bbd6
Step 2 : RUN apt-get update -y
---> Using cache
---> d2933f250090
Step 3 : RUN apt-get install wget build-essential automake -y
---> Using cache
---> e8a71b28782a
Step 4 : RUN wget http://nodejs.org/dist/latest/node-v0.10.26.tar.gz
---> Using cache
---> bae7de7b46f7
Step 5 : RUN wget http://nodejs.org/dist/latest/SHASUMS256.txt
---> Using cache
---> 245f6b6ceb84
---> 77532c879864
Step 6 : RUN sha256sum -c SHASUM256.txt 2>&1|grep -qs OK
---> Running in 77765e80f55b
2014/04/22 22:27:32 The command [/bin/sh -c sha256sum -c SHASUM256.txt 2>&1|grep -qs OK] returned a non-zero code: 1
I tried adding less SHASUMS256.txt to the Dockerfile just to confirm that file is successfully downloaded uncorrupted, and it is, but still getting the error anyway.
I'm not sure how to troubleshoot this since normally I would just manually run all the steps in an interactive container to see what goes wrong. Any suggestions much appreciated.
I think I figured this out and it's just a typo, at least when I cut and paste your commands above! You download SHASUMS256.txt but test against a file called SHASUM256.txt (missing the S). Because you throw away the output and pipe it to grep, you weren't seeing that error.
$ sha256sum -c SHASUM256.txt
sha256sum: SHASUM256.txt: No such file or directory
$ sha256sum -c SHASUM256.txt 2>&1|grep -qs OK
$ echo $?
1
Doing an echo $? tells you the return code of the last command executed (in this case 1). By correcting the file, it works for me now:
$ sha256sum -c SHASUMS256.txt 2>&1|grep -qs OK
$ echo $?
0