Hi all,
I’m a bit stuck on this task. I’m not quite sure what approach to use to solve it.
Should I install an additional plugin to Jenkins to complete it (e.g SSH)?
With this, should I use Jenkins to SSH into each App server and install httpd, etc?
otherwise, should I use Jenkins to call a local bash script to install httpd on the App servers?
I’ve been trying these approaches but still no luck as I keep finding myself stuck on when attempting any of these approaches.
Help would be appreciated.
Thanks!
Any valid approach should be fine that makes it work as per requirements mentioned in the question.
Thanks @Inderpreet
I finally figured out how to do it from Jenkins. Sadly, I didn’t install PHP properly.
Update: I finally got the desired Task Status - Success.
One of the things I struggled with was that Google Chrome was not allowing me to add user/pass for SSH sessions on Jenkins. I switched to Firefox and that part worked smoothly with this browser. Not sure why.
Next, some tips for those who are stuck with this task (without detailing exactly the how-to)
Keep in mind there are probably different approaches to solve this task. You may come up with an easier one.
Hints
-
Install the right plug-in on Jenkins to allow executing commands via SSH to remote hosts on Jobs.
-
On Jenkins’ settings, add App servers, users and passwords. I had to use Firefox
-
On the Job, you add as free text the commands to install httpd, php, change the Listening port on httpd configuration file and start the httpd process.
Ensure you look into Jenkin’s Console Output which is located in the result of running the Job. This is helpful as you need to find the proper syntax for the commands to run properly on the App Servers.
It is important to mention that these commands need to run with the correct privileges, otherwise you’ll see errors on the Console Output similar to:
[SSH] executing... . . . You need to be root to perform this command. [SSH] executing... sudo: no tty present and no askpass program specified
Tip
sudo has an -S parameter.
I used sed to modify the Listening port on the httpd config file
To install php-7 I used: https://linuxize.com/post/install-php-7-on-centos-7/
Ensure that PHP info site shown on Host 1 port 80 before clicking submit to this task. When you refresh the page you should see the page showing each time a different stapp0x server.
I hope this helps
Hi @gustavos86,
I used the " Publish Over SSH" plugin instead. I came across the approach you took but I was stuck with executing the script on all app servers in parallel. How did you manage to do this?
Thank you
btw, you could add the credentials from “Manage Jenkins” >> “Manage Credentials”, then there will be no need to add them from the button which is not working in “Configure System” with Chrome browser ( I had the same issue here).
Hi @aeldemerdash,
With the plugin I used and after adding the corresponding App server’s user/pass for the purpose of SSH sessions in Jenkins’s settings, I was able to choose an option called something similar to “exec commands over SSH” in the Jenkin’s Job. In my case, I added 3 “exec commands over SSH” in the Job, one for each of the App servers. That is how the single Job applied the respective commands to each of the App servers.
Are you able to select this option or similar in the Jenking’s Job? If so, when you run the Job, what do you see in the “Console Output” section resulting of running the Job?
(Spoiler) Jenkin's plug-in I used
SSH
Build Wrappers
This plugin executes shell commands remotely using SSH protocol
Thanks for the tip.
Cheers.
Hi @gustavos86,
Thanks a lot for this post, specially sudo with -S helped me a lot.
For others, another section where I struggled was with php page loading. Apache was not parsing my php files.
PHP Page loading Issue
This link resolved my issue.
Hello fellows @gustavos86 @aeldemerdash and @makadia.dhaval88
I am doing following steps pretty much same what you guys are doing
Jenkins --> Manage Jenkins --> Credentials --> add credentials
Add the three app server username and pass
Jenkins --> Manage Jenkins --> configure system --> go to section ( ssh remote hosts) -- add three hostnames
Create a freestyle job --> configure the job as : execute command as shell on the remote agent
I am doing pretty much same steps as you did but my pipeline stuck as below:
Started by user Admin User
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/httpd-php
[SSH] script:
# install
sudo -S yum -y install epel-release yum-utils
sudo -S yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo -S yum-config-manager --enable remi-php73
sudo -S yum -y install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
## install httpd
sudo -S yum -y update httpd
sudo -S yum -y install httpd
sudo -S systemctl start httpd
# configure apache and reload the server
sed -i "s/80/8086/g" /etc/httpd/conf/httpd.conf
#sudo systemctl restart httpd
sudo -S systemctl reload httpd
[SSH] executing...
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
any hints what I am doing wrong?
Hi @nashwan,
As I understand, sudo -S will take the password from stdin so you have to pass the password, anyway I tried to echo the passord and pipe out to sudo -S but that didn’t work for me.
I took the approach of updating sudoer file and add the user for each app server to work with no password:
$ sudo visudo
then go to the bottom of the file and add this line (app 1 as example):
tony ALL=(ALL) NOPASSWD: ALL
this way I was using sudo without problems.
Gustavo might have some details about using sudo -S, though.
Thank you
@aeldemerdash thank you very much for your reply brother Abdullah.
will see if @gustavos86 have any good hints regarding the approach I did which is pretty much same as he did.
@nashwan good luck brother. Now your job is just waiting for the password of sudo to continue executing
take care next time you start the task that they change the question details (the port of httpd + php version)
followed your suggested approach, looks better, but looks like the the packages arnt properly installed
Started by user Admin User
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/httpd-php
[SSH] script:
# install
sudo yum -y install epel-release yum-utils
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php73
sudo yum -y install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
## install httpd
sudo yum -y update httpd
sudo yum -y install httpd
sudo systemctl start httpd
# configure apache and reload the server
sed -i "s/80/6100/g" /etc/httpd/conf/httpd.conf
#sudo systemctl restart httpd
sudo systemctl reload httpd
[SSH] executing...
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
* base: mirror.plustech.de
* extras: mirror.softaculous.com
* updates: centosmirror.netcup.net
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
---> Package yum-utils.noarch 0:1.1.31-50.el7 will be updated
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
epel-release noarch 7-11 extras 15 k
Updating:
yum-utils noarch 1.1.31-54.el7_8 base 122 k
Transaction Summary
================================================================================
Install 1 Package
Upgrade 1 Package
Total download size: 137 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
--------------------------------------------------------------------------------
Total 1.5 MB/s | 137 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : yum-utils-1.1.31-54.el7_8.noarch 1/3
Installing : epel-release-7-11.noarch 2/3
Cleanup : yum-utils-1.1.31-50.el7.noarch 3/3
Verifying : epel-release-7-11.noarch 1/3
Verifying : yum-utils-1.1.31-54.el7_8.noarch 2/3
Verifying : yum-utils-1.1.31-50.el7.noarch 3/3
Installed:
epel-release.noarch 0:7-11
Updated:
yum-utils.noarch 0:1.1.31-54.el7_8
Complete!
Loaded plugins: fastestmirror, ovl
Examining /var/tmp/yum-root-D71ZWM/remi-release-7.rpm: remi-release-7.9-1.el7.remi.noarch
Marking /var/tmp/yum-root-D71ZWM/remi-release-7.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package remi-release.noarch 0:7.9-1.el7.remi will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
remi-release noarch 7.9-1.el7.remi /remi-release-7 31 k
Transaction Summary
================================================================================
Install 1 Package
Total size: 31 k
Installed size: 31 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : remi-release-7.9-1.el7.remi.noarch 1/1
Verifying : remi-release-7.9-1.el7.remi.noarch 1/1
Installed:
remi-release.noarch 0:7.9-1.el7.remi
Complete!
Loaded plugins: fastestmirror, ovl
=============================== repo: remi-php73 ===============================
[remi-php73]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php73
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php73/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php73/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php73/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php73/mirror
mirrorlist_expire = 86400
name = Remi's PHP 7.3 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php73
pkgdir = /var/cache/yum/x86_64/7/remi-php73/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php73
ui_repoid_vars = releasever,
basearch
username =
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.plustech.de
* epel: mirror.de.leaseweb.net
* extras: mirror.softaculous.com
* remi-php73: mirror.dogado.de
* remi-safe: mirror.dogado.de
* updates: centosmirror.netcup.net
Package php-mcrypt is obsoleted by php-pecl-mcrypt, trying to install php-pecl-mcrypt-1.0.4-1.el7.remi.7.3.x86_64 instead
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:7.3.26-1.el7.remi will be installed
warning: /var/cache/yum/x86_64/7/remi-safe/packages/gd-last-2.3.0-2.el7.remi.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
warning: /var/cache/yum/x86_64/7/epel/packages/libargon2-20161029-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: httpd for package: php-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libargon2.so.0()(64bit) for package: php-7.3.26-1.el7.remi.x86_64
---> Package php-cli.x86_64 0:7.3.26-1.el7.remi will be installed
---> Package php-common.x86_64 0:7.3.26-1.el7.remi will be installed
--> Processing Dependency: php-json(x86-64) = 7.3.26-1.el7.remi for package: php-common-7.3.26-1.el7.remi.x86_64
---> Package php-gd.x86_64 0:7.3.26-1.el7.remi will be installed
--> Processing Dependency: gd-last(x86-64) >= 2.1.1 for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libgd.so.3()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
--> Processing Dependency: libpng15.so.15()(64bit) for package: php-gd-7.3.26-1.el7.remi.x86_64
---> Package php-mysqlnd.x86_64 0:7.3.26-1.el7.remi will be installed
--> Processing Dependency: php-pdo(x86-64) = 7.3.26-1.el7.remi for package: php-mysqlnd-7.3.26-1.el7.remi.x86_64
---> Package php-opcache.x86_64 0:7.3.26-1.el7.remi will be installed
---> Package php-pecl-mcrypt.x86_64 0:1.0.4-1.el7.remi.7.3 will be installed
--> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-pecl-mcrypt-1.0.4-1.el7.remi.7.3.x86_64
--> Running transaction check
---> Package freetype.x86_64 0:2.8-14.el7_9.1 will be installed
---> Package gd-last.x86_64 0:2.3.0-2.el7.remi will be installed
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: gd-last-2.3.0-2.el7.remi.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-last-2.3.0-2.el7.remi.x86_64
--> Processing Dependency: libraqm.so.0()(64bit) for package: gd-last-2.3.0-2.el7.remi.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: gd-last-2.3.0-2.el7.remi.x86_64
--> Processing Dependency: libwebp.so.7()(64bit) for package: gd-last-2.3.0-2.el7.remi.x86_64
---> Package httpd.x86_64 0:2.4.6-97.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-97.el7.centos for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: system-logos >= 7.92.1-1 for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-97.el7.centos.x86_64
---> Package libX11.x86_64 0:1.6.7-3.el7_9 will be installed
--> Processing Dependency: libX11-common >= 1.6.7-3.el7_9 for package: libX11-1.6.7-3.el7_9.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.7-3.el7_9.x86_64
---> Package libXpm.x86_64 0:3.5.12-1.el7 will be installed
---> Package libargon2.x86_64 0:20161029-3.el7 will be installed
---> Package libjpeg-turbo.x86_64 0:1.2.90-8.el7 will be installed
---> Package libmcrypt.x86_64 0:2.5.8-13.el7 will be installed
---> Package libpng.x86_64 2:1.5.13-8.el7 will be installed
---> Package php-json.x86_64 0:7.3.26-1.el7.remi will be installed
---> Package php-pdo.x86_64 0:7.3.26-1.el7.remi will be installed
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package centos-logos.noarch 0:70.0.6-3.el7.centos will be installed
---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed
--> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64
--> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-97.el7.centos will be installed
---> Package libX11-common.noarch 0:1.6.7-3.el7_9 will be installed
---> Package libraqm.x86_64 0:0.7.0-4.el7 will be installed
--> Processing Dependency: libfribidi.so.0()(64bit) for package: libraqm-0.7.0-4.el7.x86_64
--> Processing Dependency: libharfbuzz.so.0()(64bit) for package: libraqm-0.7.0-4.el7.x86_64
---> Package libtiff.x86_64 0:4.0.3-35.el7 will be installed
--> Processing Dependency: libjbig.so.2.0()(64bit) for package: libtiff-4.0.3-35.el7.x86_64
---> Package libwebp7.x86_64 0:1.0.3-1.el7.remi will be installed
---> Package libxcb.x86_64 0:1.13-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Running transaction check
---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed
--> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch
---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed
---> Package fribidi.x86_64 0:1.0.2-1.el7_7.1 will be installed
---> Package harfbuzz.x86_64 0:1.7.5-2.el7 will be installed
--> Processing Dependency: libgraphite2.so.3()(64bit) for package: harfbuzz-1.7.5-2.el7.x86_64
---> Package jbigkit-libs.x86_64 0:2.0-11.el7 will be installed
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Running transaction check
---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed
---> Package graphite2.x86_64 0:1.3.10-1.el7_3 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
php x86_64 7.3.26-1.el7.remi remi-php73 3.2 M
php-cli x86_64 7.3.26-1.el7.remi remi-php73 4.9 M
php-common x86_64 7.3.26-1.el7.remi remi-php73 1.1 M
php-gd x86_64 7.3.26-1.el7.remi remi-php73 84 k
php-mysqlnd x86_64 7.3.26-1.el7.remi remi-php73 238 k
php-opcache x86_64 7.3.26-1.el7.remi remi-php73 313 k
php-pecl-mcrypt x86_64 1.0.4-1.el7.remi.7.3 remi-php73 29 k
Installing for dependencies:
apr x86_64 1.4.8-7.el7 base 104 k
apr-util x86_64 1.5.2-6.el7 base 92 k
centos-logos noarch 70.0.6-3.el7.centos base 21 M
dejavu-fonts-common noarch 2.33-6.el7 base 64 k
dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M
fontconfig x86_64 2.13.0-4.3.el7 base 254 k
fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k
freetype x86_64 2.8-14.el7_9.1 updates 380 k
fribidi x86_64 1.0.2-1.el7_7.1 base 79 k
gd-last x86_64 2.3.0-2.el7.remi remi-safe 135 k
graphite2 x86_64 1.3.10-1.el7_3 base 115 k
harfbuzz x86_64 1.7.5-2.el7 base 267 k
httpd x86_64 2.4.6-97.el7.centos updates 2.7 M
httpd-tools x86_64 2.4.6-97.el7.centos updates 93 k
jbigkit-libs x86_64 2.0-11.el7 base 46 k
libX11 x86_64 1.6.7-3.el7_9 updates 607 k
libX11-common noarch 1.6.7-3.el7_9 updates 164 k
libXau x86_64 1.0.8-2.1.el7 base 29 k
libXpm x86_64 3.5.12-1.el7 base 55 k
libargon2 x86_64 20161029-3.el7 epel 23 k
libjpeg-turbo x86_64 1.2.90-8.el7 base 135 k
libmcrypt x86_64 2.5.8-13.el7 epel 99 k
libpng x86_64 2:1.5.13-8.el7 base 213 k
libraqm x86_64 0.7.0-4.el7 epel 15 k
libtiff x86_64 4.0.3-35.el7 base 172 k
libwebp7 x86_64 1.0.3-1.el7.remi remi-safe 266 k
libxcb x86_64 1.13-1.el7 base 214 k
mailcap noarch 2.1.41-2.el7 base 31 k
php-json x86_64 7.3.26-1.el7.remi remi-php73 69 k
php-pdo x86_64 7.3.26-1.el7.remi remi-php73 131 k
Transaction Summary
================================================================================
Install 7 Packages (+30 Dependent packages)
Total download size: 39 M
Installed size: 86 M
Downloading packages:
Public key for gd-last-2.3.0-2.el7.remi.x86_64.rpm is not installed
Public key for libargon2-20161029-3.el7.x86_64.rpm is not installed
Public key for php-7.3.26-1.el7.remi.x86_64.rpm is not installed
Importing GPG key 0x00F97F56:
Userid : "Remi Collet <[email protected]>"
Fingerprint: 1ee0 4cce 88a4 ae4a a29a 5df5 004e 6f47 00f9 7f56
Package : remi-release-7.9-1.el7.remi.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <[email protected]>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
--------------------------------------------------------------------------------
Total 21 MB/s | 39 MB 00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : php-json-7.3.26-1.el7.remi.x86_64 1/37
Installing : php-common-7.3.26-1.el7.remi.x86_64 2/37
Installing : 2:libpng-1.5.13-8.el7.x86_64 3/37
Installing : freetype-2.8-14.el7_9.1.x86_64 4/37
Installing : libjpeg-turbo-1.2.90-8.el7.x86_64 5/37
Installing : apr-1.4.8-7.el7.x86_64 6/37
Installing : apr-util-1.5.2-6.el7.x86_64 7/37
Installing : fontpackages-filesystem-1.44-8.el7.noarch 8/37
Installing : libargon2-20161029-3.el7.x86_64 9/37
Installing : php-cli-7.3.26-1.el7.remi.x86_64 10/37
Installing : dejavu-fonts-common-2.33-6.el7.noarch 11/37
Installing : dejavu-sans-fonts-2.33-6.el7.noarch 12/37
Installing : fontconfig-2.13.0-4.3.el7.x86_64 13/37
Installing : httpd-tools-2.4.6-97.el7.centos.x86_64 14/37
Installing : php-pdo-7.3.26-1.el7.remi.x86_64 15/37
Installing : libwebp7-1.0.3-1.el7.remi.x86_64 16/37
Installing : libXau-1.0.8-2.1.el7.x86_64 17/37
Installing : libxcb-1.13-1.el7.x86_64 18/37
Installing : graphite2-1.3.10-1.el7_3.x86_64 19/37
Installing : harfbuzz-1.7.5-2.el7.x86_64 20/37
Installing : jbigkit-libs-2.0-11.el7.x86_64 21/37
Installing : libtiff-4.0.3-35.el7.x86_64 22/37
Installing : libX11-common-1.6.7-3.el7_9.noarch 23/37
Installing : libX11-1.6.7-3.el7_9.x86_64 24/37
Installing : libXpm-3.5.12-1.el7.x86_64 25/37
Installing : mailcap-2.1.41-2.el7.noarch 26/37
Installing : fribidi-1.0.2-1.el7_7.1.x86_64 27/37
Installing : libraqm-0.7.0-4.el7.x86_64 28/37
Installing : gd-last-2.3.0-2.el7.remi.x86_64 29/37
Installing : centos-logos-70.0.6-3.el7.centos.noarch 30/37
Installing : httpd-2.4.6-97.el7.centos.x86_64 31/37
Installing : libmcrypt-2.5.8-13.el7.x86_64 32/37
Installing : php-pecl-mcrypt-1.0.4-1.el7.remi.7.3.x86_64 33/37
Installing : php-7.3.26-1.el7.remi.x86_64 34/37
Installing : php-gd-7.3.26-1.el7.remi.x86_64 35/37
Installing : php-mysqlnd-7.3.26-1.el7.remi.x86_64 36/37
Installing : php-opcache-7.3.26-1.el7.remi.x86_64 37/37
Verifying : fontconfig-2.13.0-4.3.el7.x86_64 1/37
Verifying : php-7.3.26-1.el7.remi.x86_64 2/37
Verifying : gd-last-2.3.0-2.el7.remi.x86_64 3/37
Verifying : libargon2-20161029-3.el7.x86_64 4/37
Verifying : libmcrypt-2.5.8-13.el7.x86_64 5/37
Verifying : fontpackages-filesystem-1.44-8.el7.noarch 6/37
Verifying : php-common-7.3.26-1.el7.remi.x86_64 7/37
Verifying : centos-logos-70.0.6-3.el7.centos.noarch 8/37
Verifying : php-pdo-7.3.26-1.el7.remi.x86_64 9/37
Verifying : php-json-7.3.26-1.el7.remi.x86_64 10/37
Verifying : libtiff-4.0.3-35.el7.x86_64 11/37
Verifying : apr-1.4.8-7.el7.x86_64 12/37
Verifying : fribidi-1.0.2-1.el7_7.1.x86_64 13/37
Verifying : dejavu-fonts-common-2.33-6.el7.noarch 14/37
Verifying : httpd-2.4.6-97.el7.centos.x86_64 15/37
Verifying : libxcb-1.13-1.el7.x86_64 16/37
Verifying : php-cli-7.3.26-1.el7.remi.x86_64 17/37
Verifying : mailcap-2.1.41-2.el7.noarch 18/37
Verifying : libXpm-3.5.12-1.el7.x86_64 19/37
Verifying : libjpeg-turbo-1.2.90-8.el7.x86_64 20/37
Verifying : libX11-common-1.6.7-3.el7_9.noarch 21/37
Verifying : libX11-1.6.7-3.el7_9.x86_64 22/37
Verifying : harfbuzz-1.7.5-2.el7.x86_64 23/37
Verifying : apr-util-1.5.2-6.el7.x86_64 24/37
Verifying : dejavu-sans-fonts-2.33-6.el7.noarch 25/37
Verifying : 2:libpng-1.5.13-8.el7.x86_64 26/37
Verifying : httpd-tools-2.4.6-97.el7.centos.x86_64 27/37
Verifying : jbigkit-libs-2.0-11.el7.x86_64 28/37
Verifying : libraqm-0.7.0-4.el7.x86_64 29/37
Verifying : php-opcache-7.3.26-1.el7.remi.x86_64 30/37
Verifying : php-mysqlnd-7.3.26-1.el7.remi.x86_64 31/37
Verifying : graphite2-1.3.10-1.el7_3.x86_64 32/37
Verifying : libXau-1.0.8-2.1.el7.x86_64 33/37
Verifying : php-pecl-mcrypt-1.0.4-1.el7.remi.7.3.x86_64 34/37
Verifying : libwebp7-1.0.3-1.el7.remi.x86_64 35/37
Verifying : freetype-2.8-14.el7_9.1.x86_64 36/37
Verifying : php-gd-7.3.26-1.el7.remi.x86_64 37/37
Installed:
php.x86_64 0:7.3.26-1.el7.remi
php-cli.x86_64 0:7.3.26-1.el7.remi
php-common.x86_64 0:7.3.26-1.el7.remi
php-gd.x86_64 0:7.3.26-1.el7.remi
php-mysqlnd.x86_64 0:7.3.26-1.el7.remi
php-opcache.x86_64 0:7.3.26-1.el7.remi
php-pecl-mcrypt.x86_64 0:1.0.4-1.el7.remi.7.3
Dependency Installed:
apr.x86_64 0:1.4.8-7.el7
apr-util.x86_64 0:1.5.2-6.el7
centos-logos.noarch 0:70.0.6-3.el7.centos
dejavu-fonts-common.noarch 0:2.33-6.el7
dejavu-sans-fonts.noarch 0:2.33-6.el7
fontconfig.x86_64 0:2.13.0-4.3.el7
fontpackages-filesystem.noarch 0:1.44-8.el7
freetype.x86_64 0:2.8-14.el7_9.1
fribidi.x86_64 0:1.0.2-1.el7_7.1
gd-last.x86_64 0:2.3.0-2.el7.remi
graphite2.x86_64 0:1.3.10-1.el7_3
harfbuzz.x86_64 0:1.7.5-2.el7
httpd.x86_64 0:2.4.6-97.el7.centos
httpd-tools.x86_64 0:2.4.6-97.el7.centos
jbigkit-libs.x86_64 0:2.0-11.el7
libX11.x86_64 0:1.6.7-3.el7_9
libX11-common.noarch 0:1.6.7-3.el7_9
libXau.x86_64 0:1.0.8-2.1.el7
libXpm.x86_64 0:3.5.12-1.el7
libargon2.x86_64 0:20161029-3.el7
libjpeg-turbo.x86_64 0:1.2.90-8.el7
libmcrypt.x86_64 0:2.5.8-13.el7
libpng.x86_64 2:1.5.13-8.el7
libraqm.x86_64 0:0.7.0-4.el7
libtiff.x86_64 0:4.0.3-35.el7
libwebp7.x86_64 0:1.0.3-1.el7.remi
libxcb.x86_64 0:1.13-1.el7
mailcap.noarch 0:2.1.41-2.el7
php-json.x86_64 0:7.3.26-1.el7.remi
php-pdo.x86_64 0:7.3.26-1.el7.remi
Complete!
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.plustech.de
* epel: mirror.de.leaseweb.net
* extras: mirror.softaculous.com
* remi-php73: mirror.dogado.de
* remi-safe: mirror.dogado.de
* updates: centosmirror.netcup.net
No packages marked for update
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.plustech.de
* epel: mirror.de.leaseweb.net
* extras: mirror.softaculous.com
* remi-php73: mirror.23media.com
sed: couldn't open temporary file /etc/httpd/conf/sed7196hf: Permission denied
* remi-safe: mirror.23media.com
* updates: centosmirror.netcup.net
Package httpd-2.4.6-97.el7.centos.x86_64 already installed and latest version
Nothing to do
[SSH] completed
[SSH] exit-status: 0
here is my script:
# install
sudo yum -y install epel-release yum-utils
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php73
sudo yum -y install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
## install httpd
sudo yum -y update httpd
sudo yum -y install httpd
sudo systemctl start httpd
# configure apache and reload the server
sed -i "s/80/6100/g" /etc/httpd/conf/httpd.conf
#sudo systemctl restart httpd
sudo systemctl reload httpd
Hi @nashwan,
As perfectly told by @aeldemerdash, “sudo -S will take the password from stdin”.
This link worked perfectly for me.
Quick Answer
echo mypassword | sudo -S command
@makadia.dhaval88
followed your suggestion, I am able to access the hosts, and install the packages, but still not able to get the config. dono what is missing in my script.
echo BigGr33n | sudo -S yum -y install epel-release yum-utils
echo BigGr33n | sudo -S yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
echo BigGr33n | sudo -S yum-config-manager --enable remi-php72
echo BigGr33n | sudo -S yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
echo BigGr33n | sudo -S yum -y update httpd
echo BigGr33n | sudo -S yum -y install httpd
echo BigGr33n | sudo -S systemctl start httpd
echo BigGr33n | sudo -S sed -i “s/80/3004/g” /etc/httpd/conf/httpd.conf
echo BigGr33n | sudo -S systemctl reload httpd
Check the tick mark for the verbose output on the job ssh server configuration. You will be able to track the error easily.