- Newest
- Most votes
- Most comments
A couple of things here, firstly the script has lots of sudo
commands in lines 4-8 and 26-33, meaning it isn't intended to be run as root (because if it was, why bother with sudo), and also you've correctly identified this script is meant for AL2 and won't work on AL2023.
The giveaway for the latter is sudo amazon-linux-extras install epel -y
because AL2023 doesn't support EPEL https://docs.aws.amazon.com/linux/al2023/ug/compare-with-al2.html#epel
Fresh answer, because my previous one was going down a rabbit hole.
The errors like ./install-imap-extension.sh: line 4: sudo: command not found and so on are because of the Linux shell's PATH being set in line 3 of the script - remove this line, as it's just wrong.
Secondly the presence of sudo in lines 4-8 and 26-33 suggest the script isn't intended to be run as root, but as a non-root user who has sudo-to-root privileges. And as this script is written for Amazon Linux 2, such a user would be ec2-user.
That's not to say it must not be run as root, most likely it will work as root if you got rid of PATH=pwd
on line 3, just that it's not intended to be run as root.
As mentioned, the script is clearly meant to be run with Amazon Linux 2 as the target platform, and you're running Amazon Linux 2023. Which won't work because it relies on the presence of the EPEL software repository (rows 5 & 6) which is not supported on AL2023 https://docs.aws.amazon.com/linux/al2023/ug/compare-with-al2.html#epel
You're going to have to hack around a lot if you want to get the script into a position that it will work with AL2023. A few things that might progress it are in the comments under my previous answer, but I admit they do assume knowledge of Linux and YUM repos, etc. You might be better off reaching out to the creator of the original script and asking if they have any solution to getting the IMAP extension installed on AL2023, since you can't be the first person to have tried to do this.
The other alternative is to work on an Amazon Linux 2 EC2, but I guess that isn't an option for you or you would have done it already.
You may find something of value on the PHP on AL2023 webpage https://docs.aws.amazon.com/linux/al2023/ug/php.html
Thanks for your answer! Now I know why the script does not work but I would like to see how to install it on this amazon linux version, pls I need a solution (changing the linux version is not a solution)
The best person to ask for support on that script is the person that wrote it, and their contact details will be on their GitHub page. The re:Post community isn't a place for debugging somebody else's software, nor for hacking around to try and make it work on a system that it wasn't intended to work on.
A few suggestions are offered above, based on a general understanding of Linux as I don't understand the finer details of what it is you need here. If they don't work for you or you can't follow them then the best place to ask for help would be a PHP fourm on somewhere like StackOverflow. There you are more likely to find people who really understand what it is you want to do, and even may have figured out how to get this to work on AL2023.
Good luck.
Hi Steve, I ended up installing Amazon Linux 2 and I followed the next instructions: https://serverfault.com/questions/1032506/how-to-enable-imap-php-extension-on-aws-ec2-instance, however, when I try to the last step, that is, restart php-fpm I receive an error. Could you please, give me an answer to install PHP IMAP on Amazon Linux 2? (I will create a new question)
Sure, it would be best to ask this as a new question on here. It also looks like you are getting some traction from the contributors on the serverfault post you added a comment to.
Have you reached out to the original author of the script?
Relevant content
- asked 8 months ago
- asked 2 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated a month ago
So.. how could I install IMAP PHP on amazon link 2023?
It could be worth your while trying to engage with the maintainer of the GitHub project in your original question, in case this question has been asked before.
This is the key line
sudo yum install libc-client-devel uw-imap-static openssl-devel -y
openssl-devel is part of AL2023 https://docs.aws.amazon.com/linux/al2023/release-notes/vercmp-AL1-AL2023.2.html
So you still need to source the libc-client-devel and uw-imap-static RPMs from somewhere.
I can't find libc-client-devel in the EPEL repo on an AL2 instrance that I run (though a google search shows plenty of places to get the RPM from, none of which are AWS or Fedora-like official sites so I won't post a link).
You can find the individual uw-imap-static package at https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/u/ There look to be a lot of dependencies on this, including another EPEL package libc-client so you might want to install that one first.
The whole list of AL2023 packages is at https://docs.aws.amazon.com/linux/al2023/release-notes/all-packages.html
If you want to get a package(s) added to AL2023 then you can request it through https://github.com/amazonlinux/amazon-linux-2023/issues/new?assignees=&labels=&template=package-request.md&title=%5BPackage+Request%5D+-+Title
Thanks for your reply. OMG so complicated, why? could you send me a PM with instructions to install it? I just want a solution :( yesterday I spent a lot of time on it
How can I find an answer?