I am trying to make an ebextensions file which will install wkhtmltopdf.
Currently it looks like this:
packages:
yum:
xorg-x11-fonts-75dpi: []
libpng: []
xz: []
urw-fonts: []
libXext: []
openssl-devel: []
libXrender: []
rpm:
wkhtmltopdf: https://s3-eu-west-1.amazonaws.com/myS3Account/wkhtmltox-0.12.2.1_linux-centos5-amd64.rpm
In this case, wkthmltopdf fails to install. I get the following error:
Failed dependencies:
xorg-x11-fonts-75dpi is needed by wkhtmltox-1:0.12.2.1-1.x86_64
If I use SSH to connect to my EC2 instance, I can sucessfully install wkhtml by manually running "yum install xorg-x11-fonts-75dpi", followed by "wget wkthmltopdf-..." and "rpm --install wkhtmltopdf-..". If I skip the yum step, rpm complains that wkhtmltopdf needs the xorg package.
It seems like xorg-x11-fonts-75dpi is not installed by ebextensions on deploy. Am I doing something wrong?
According to the docs:
Packages are processed in the following order: rpm, yum, and then rubygems and python.
Elastic beanstalk first processes your rpm package, causing the error and never gets to the yum packages.
There are a few ways to solve this.
1) Run the rpm install through a command like
commands:
install_wkhtmltox:
command: yum -y install https://s3-eu-west-1.amazonaws.com/myS3Account/wkhtmltox-0.12.2.1_linux-centos5-amd64.rpm
This should automatically solve dependencies through yum.
2) Split the .ebextensions files to two: 01_install_dependencies.config and 02_install_wkhtmltox.config. In the 01-file install yum packages, in the 02 file install the rpm. This way you can "override" the package installation order
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-packages
Related
do you know if there exists a way to use yum from inside a Lambda function. For example, I need to install mdbtools, but if in my lambda I write (in Python)
subprocess.run(['yum', 'install', 'mdbtools'])
then it says
[ERROR] FileNotFoundError: [Errno 2] No such file or directory: 'yum'
I also tried with
os.system('yum install mdbtools')
but it says
sh: yum: command not found
Finally, I read from here to enable also the EPEL repository, so I tried with
os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')
os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')
os.system('sudo amazon-linux-extras install epel -y; sudo yum-config-manager --enable epel; yum install mdbtools')
but again I get
sh: sudo: command not found
sh: sudo: command not found
sh: yum: command not found
Can you help? Thanks in advance.
If yum existed in the Lambda environment, it should be in /bin/yum. I've looked there, and don't see it, so I'm going to assume that you won't be able to run it.
If you need a library that can't be packaged in a deployment bundle, you'll need to use a Lambda Container Image. Start with one of the pre-built base images, and run yum in your Dockerfile.
However, I see that you've tagged this question with ms-access. If you're trying to install a Microsoft product in a the Linix-based Lambda environment, you'll need to do a lot more than just run yum.
This is not how it is intended to work with dependencies in Lambdas.
It can be achieved in another way though.
You should include all the libs and dependencies in your .zip file which you upload. More information on that here.
I'm pretty new in AWS, I've tried to install PHP on my virtual machine, but it doesn't works, I get the error:
[root#ip-xxx-xxx-xxx-xxx user]# yum install apache2 libapache2-mod-php5 php5 mysql-
server php5-mysql
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No package apache2 available.
No package libapache2-mod-php5 available.
No package php5 available.
No package mysql-server available.
No package php5-mysql available.
Error: Nothing to do
I don't know the reason of this, I already tried the comamnd yum update, but it doesn't help, please help me
PHP5 is quite old and is probably not available anymore in the YUM package manager.
Also I think the tutorial you are using is Debian/Ubuntu based.
Apache2 is called httpd24 in yum for instance.
That would look something like this:
sudo yum install -y httpd24 php72 mysql57-server php72-mysqlnd
Or if you are using the Amazon Linux 2 image, then use this command:
sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
To find out which specific image you are running:
cat /etc/system-release
Please check out the AWS documentation for an up-to-date tutorial on howto deploy your own LAMP-server:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html
I need to install php-imap on amazon ec2 linux 2 instance.
All the php stuff is inside amzn2extra-lamp-mariadb10.2-php7.2 but php-imap package is missing.
Any advice ?
Thanks
I installed it like this.
I downloaded the php source code of the currently installed version in my Amazon Linux 2
wget http://php.net/get/php-7.2.8.tar.bz2/from/a/mirror
Unpacked it and went into php-7.2.8/ext/imap/
Compiled extension:
phpize
./configure
I got some errors.
Some U8T_CANONICAL stuff so
sudo yum install libc-client-devel
Then libc-client.a not found so created a symlink for it:
cd /usr/lib
sudo ln -s /usr/lib64/libc-client.a
some other imap library error so:
sudo yum install uw-imap-static
I got some other errors so the working configure line was:
./configure --with-kerberos --with-imap-ssl
make
SUCCESS!
cd php-7.2.8/ext/imap/modules
sudo cp imap.so /usr/lib64/php/modules/
Created an ini file to load it:
sudo vi /etc/php.d/30-imap.ini
added to the file this content:
extension=imap
restarted php service (you might need to restart httpd depending on your php installation):
sudo systemctl restart php-fpm
PHPinfo now contains:
imap
IMAP c-Client Version 2007f
SSL Support enabled
Kerberos Support enabled
For those who are facing the U8T_CANONICAL error and can't being able to install the libc-client-devel on Amazon Linux 2 AMI need to do something extra to resolve the U8T_CANONICAL error.
The main problem is that libc-client-devel isn't available so we need to do it in another way.
I found this link while searching for my problem. The solution that is posted here is solid. The following link that i gave is for those who are not being able to install the libc-client-devel will be benifited from the link.
Or you could just copy paste the commands i'm giving below.
1 - sudo yum groupinstall "Development Tools"
2 - sudo amazon-linux-extras install epel
3 - yum install epel-release
4 - sudo yum install libc-client-devel uw-imap-static openssl-devel
5 - sudo ln -s /usr/lib64/libc-client.a /usr/lib
The rest can be followed from respondent.
Again thanks to the person who answered.
Same problem here.
I came from debian/ubuntu and i miss a lot of php packages on aws linux2.
I know it's still a candidate and not a final LTS release. Only worked for a month with this distro and saw a lot of changes and updates. Some php dependencies can be solved with pear or pecl, but I couldn't get nothing working on php-imap.
php-imap depends on libc-client (maybe that's a problem?)
Here is my solution.
Search for the libc-client rpm that correspond to your version and
install manually.
Search for the rpm that corresponds to your php installed version. In my case it was 7.2.5**-2** about 2 weeks ago. (today is
7.2.5**-3** ) and isntall manually
CODE
wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64//php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm -P /tmp
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libc-client-2007f-16.el7.x86_64.rpm -P /tmp
rpm -i /tmp/libc-client-2007f-16.el7.x86_64.rpm
rpm -i /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm
If it fails because Failed dependencies:
rpm -ivh /tmp/php72u-imap-7.2.5-2.ius.centos7.x86_64.rpm --nodeps
I dont like this solution, but can't find for now any other solution more stable and easy. It will be a pain with updates....
I'm trying to deploy a django project with Elastic Beanstalk cli. I followed the Official Amazon Tutorial as well as this Tutorial on realpython.com.
The Deploymentprocess works fine as long as I stick to a newly created Django Project with just a view dependencies for pip.
When try it with my Django Project The Deployment fails because the requirements.txt is invalid. I created it inside my virutalenv like this: pip freeze > requirements.txt
braintree==3.32.0
cffi==1.9.1
cryptography==1.7
Django==1.10.4
django-allauth==0.29.0
django-betterforms==1.1.4
django-contrib-comments==1.7.3
django-formtools==1.0
django-payments==0.9.6
django-tinymce==2.4.0
enum34==1.1.6
idna==2.1
ipaddress==1.0.17
oauthlib==2.0.1
Pillow==3.4.2
pyasn1==0.1.9
pycparser==2.17
PyJWT==1.4.2
python-openid==2.2.5
requests==2.12.3
requests-oauthlib==0.7.0
six==1.10.0
stripe==1.43.0
suds-jurko==0.6
xmltodict==0.10.2
In my despair I tried to activate the dependencies one by one. The Deployment process is so slow that I gave up after a while. But now I know now that Django==1.10.4, django-allauth==0.29.0, django-betterforms==1.1.4, django-contrib-comments==1.7.3, django-formtools==1.0 and django-tinymce==2.4.0 are not the problem. With django-payments==0.9.6 it fails but its not the only dependency that causes the problem.
This is in my activity.log:
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/opt/python/run/venv/bin/python2.7 -c "import setuptools, tokenize;
__file__='/tmp/pip-build-BF9Oen/cffi/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
install --record /tmp/pip-BsXWzo-record/install-record.txt --single-version-externally-managed --compile --install-headers
/opt/python/run/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-BF9Oen/cffi
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2016-12-13 14:49:05,155 ERROR
Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command
'/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt'
returned non-zero exit status 1 (Executor::NonZeroExitStatus)
I't could have something to do with missing Software. I know how to use the .ebextensions .config files but I don't know whats missing. Is there a descent way to debug this locally?
You seem to have problems with both FFI and Python. You have Cryptography in use but don't probably have all the required libraries Install Python and FFI requirements and OpenSSL dependencies for Cryptography.
$ eb ssh # SSH into your EB environment
$ sudo su # gain root privileges
$ yum install python-devel # or python27-devel
$ yum install libffi-devel # CFFI / FFI requirements
$ yum install openssl-devel # Cryptography requirements
If Pip complains, make sure you have the latest pip installed:
# repeat SSH and root privilege steps
$ source /opt/python/run/venv/bin/activate # activate Python environment
$ pip install --upgrade pip # upgrade to latest pip
To make the changes permanent, append them to your EB configuration. This also works if you do not have direct SSH access.
# .ebextensions/10_packages.config excerpt
packages:
yum:
gcc: []
libffi-devel: []
openssl-devel: []
python-devel: [] # or python27-devel
.ebextensions folder files with the .config suffix are state declarations for the Elastic Beanstalk environment. That is, they are instructions that are run on each Elastic Beanstalk deployment when you run eb deploy or your CI environment deploys code to EB.
Amazon Linux is an RPM based Linux that uses YUM for package management. You will find RHEL / CentOS / OpenSUSE instructions for Python package installation helpful for the Amazon Linux distribution.
There typically isn’t a way to debug these issues locally, because people don’t normally run Amazon linux on their local machines, and EB has a very specific environment setup that is not easy to reproduce (at least it wasn’t for me).
If you want to do it fast, just ssh to one of your EB/EC2 instances and try to install the pip requirements one-by-one by hand. If you want to do it right, you do have to go through this list of requirements one-by-one. (i.e., start with one requirement in the requirements file, deploy, then two requirements, then three requirements, etc.). You may want to start with upgrading pip by adding
pip==9.0.1
At the top of your requirements file and also making sure the following Amazon Linux (if that is what you are using) are installed:
python-devel
libffi
libffi-devel
I have been searching the web hours on end for several days and I am unable to install psycopg2 library on my Linux machine (CentOS - 2.6.32-431.3.1.el6.x86_64 GNU/Linux).
I know that the problem is that I am missing the libpq header files since I am getting this message after attempting pip install psycopg2: libpq-fe.h: No such file or directory
http://initd.org/psycopg/docs/install.html#install-from-source
Almost all the articles I found pointed me to use apt-get on CentOS but apt-get is not a standard tool on CentOS 6.3 so I've been trying yum install instead.
However, every time I try to use sudo yum install to download something the package is not available. For example:
yum install postgresql-devel
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
drivesrvr | 2.2 kB 00:00
No package postgresql-devel available.
Error: Nothing to do
I've tried this for:
yum install postgresql-server
yum install python-devel
service postgresql initdb
service postgresql start
yum install python-psycopg2
Any ideas? Without the the libpq header files I can't install the psycopg2 module that is necessary for my Python program. This is for Python 2.7.12. And PostgreSQL 9.3.13.
I had this exact issue on Fedora 2016.09 box on Amazon. I was able to install postgresql-devel via yum, but that didn't do the trick; the version seemed to be out of date.
I solved it using:
sudo yum install /usr/include/libpq-fe.h
This installs an updated version of postgresql-devel which allows psycopg2 to compile correctly when installing through pip.