not able to start or stop shiny-server on RedHat AWS - amazon-ec2

I've got shiny installed and running on a RedHat AWS EC2 instance. However, it seems to be forever running, because typing stop shiny-server or start shiny-server results in the error: -bash: restart: command not found. I don't see this when I install shiny on a Ubuntu instance. Is there a way to fix this on RedHat?

You're probably using RedHat 7, so you should use systemd:
sudo systemctl start shiny-server
sudo systemctl stop shiny-server
sudo systemctl restart shiny-server

Related

Error running systemctl to start service in Amazon Linux 2

I am trying to build a simple Apache/PHP server using the Amazon Linux 2 image. I have the following:
Dockerfile
FROM amazonlinux:2
RUN amazon-linux-extras install epel -y &&\
amazon-linux-extras install php7.4 -y &&\
yum update -y &&\
yum install httpd -y
COPY --chown=root:root docker/script/startup /startup
ENTRYPOINT /startup
startup
#!/usr/bin/env bash
mkdir -p /run/dbus # Added this based on other SO question
dbus-daemon --system # Added this based on other SO question
systemctl enable dbus # Added this based on other SO question
systemctl start dbus # Added this based on other SO question
systemctl status dbus # Added this based on other SO question
systemctl enable httpd
systemctl start httpd
systemctl status httpd
/bin/bash
docker-compose.yml
web:
build: .
container_name: "${APP_NAME}-app"
environment:
VIRTUAL_HOST: "${WEB_HOST}"
env_file:
- ./.env-local
working_dir: "/${APP_NAME}/app"
restart: "no"
privileged: true # Added this based on other SO question
volumes:
- "./app:/${APP_NAME}/app:ro"
- ./docker:/docker
- "./conf:/${APP_NAME}/conf:ro"
- "./vendor:/${APP_NAME}/vendor:ro"
- "./conf:/var/www/conf:ro"
- "./web:/var/www/html/"
depends_on:
- composer
I run this with the following command:
docker run -it web bash
And this is what it gives me:
Failed to get D-Bus connection: Operation not permitted
Failed to get D-Bus connection: Operation not permitted
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service, pointing to /usr/lib/systemd/system/httpd.service.
Failed to get D-Bus connection: Operation not permitted
Failed to get D-Bus connection: Operation not permitted
I don't understand why I'm getting this or how to resolve?
Suggesting to avoid systemd service units in a docker image.
Instead use cronttab script with #boot directive/selector.
In addition dbus is centrally managed by kernel and not allowed at container level.
If Docker service is up then you probably have dbus active and running.
You can add capabilities to the root user running in the container. Read more here.
As last resort try to disable SELinux in your docker image.
I was running into the same issue trying to run systemctl from within the Amazon Linux 2 docker image
Dockerfile:
FROM amazonlinux:latest
# update and install httpd 2.4.53, php 7.4.28 with php extensions
RUN yum update -y; yum clean all
RUN yum install -y httpd amazon-linux-extras
RUN amazon-linux-extras enable php7.4
RUN yum clean metadata
RUN yum install -y php php-{pear,cli,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip}
# update website files
WORKDIR /var/www/html
COPY phpinfo.php /var/www/html
RUN chown -R apache:apache /var/www
CMD ["/usr/sbin/httpd","-DFOREGROUND"]
EXPOSE 80
EXPOSE 443
$ docker build -t azl1
$ docker run -d -p 8080:80 --name azl1_web azl1
pointing a browser to the IP:8080/phpinfo.php brought up the normal phpinfo page as expected pointing to a successful php 7.4.28 installation.

How can I install brew httpd on MacOS 11 Big Sur?

I've upgraded macOS version to 11 Big Sur and unable to use brew's apache instead of build in version.
What I did:
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew intall httpd
When I'm trying to start the installed httpd it says that apache is started
==> Successfully started httpd (label: homebrew.mxcl.httpd)
but when I run brew services command I see that httpd is not started (and http://localhost:8080 is not working).
sergeylyskov#MacBook-Pro-Sergey ~ % brew services
Name Status User Plist
httpd error sergeylyskov /Users/sergeylyskov/Library/LaunchAgents/homebrew.mxcl.httpd.plist
php#7.3 stopped
php#7.4 stopped
postgresql#12 stopped
P.S. I want to use brew's version because seems like build in apache is not properly work with php modules (it don't show xdebug and imagick extensions in phpinfo())
Any advice?
I tried uninstalling and then reinstalling httpd, but that didn't work initially. When you uninstall, brew does NOT remove the /usr/local/etc/httpd config directory (which is sensible because you might have a lot of things configured in there and not backed up). However, these configuration files might well be outdated (or customized) in a way that makes them incompatible with the latest version of httpd, causing it to fail. So I did the following:
brew services stop httpd
brew uninstall httpd
mv /usr/local/etc/httpd /usr/local/etc/httpd-old
brew install httpd
brew services start httpd
This got it running again with fresh config files; I can now copy over any specific configuration details from httpd-old into the new httpd dir.
Also note: by default, httpd serves from /usr/local/var/www. This dir is not affected by the uninstall-reinstall process, so only your config files need re-doing.

Why can't I run Docker on my Mac OSX?

I installed Docker on my Mac OSX machine (El-Capitan) using Homebrew.
But when I try to run it, it gives me the error shown below.
$ docker --version
Docker version 17.06.0-ce, build 02c1d87
$ docker-compose --version
docker-compose version 1.14.0, build unknown
$ docker-machine --version
docker-machine version 0.12.2, build 9371605
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?
How can I fix it?
There is no need to uninstall docker, I hit this hurdle as well and on Mac, follow these steps
Go to the application folder and click the docker icon
wait for it to start
Once the docker starts, you can run any docker command without any issue
It looks like you need to start the Docker daemon first. Check the caveats section of brew info docker-machine.
$ brew info docker-machine
docker-machine: stable 0.12.2 (bottled), HEAD
Create Docker hosts locally and on cloud providers
https://docs.docker.com/machine
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/docker-machine.rb
==> Dependencies
Build: go ✔, automake ✔
==> Requirements
Build: git ✔
==> Caveats
To have launchd start docker-machine now and restart at login:
brew services start docker-machine
Or, if you don't want/need a background service you can just run:
docker-machine start

ejabberdctl not found in bash Ubuntu(installing ejabberd)

I was trying to install ejabberd with applying the tutorials in many site to my VM which is ubuntu but I am stuck in the beginning. After I wrote
sudo apt-get update
sudo apt-get -y install ejabberd
it installs ejabberd. But when I try to write the following
ejabberdctl register admin localhost mypassword
it says ejabberdctl not found. I also tried to restart it with but it is still same.
sudo service ejabberd restart
Note: I did not install erlang seperately. Can it be the problem?
Try sudo ejabberdctl,
if it didn't work, Do:
sudo updatedb
sudo locate ejabberdctl
check if the output is in your $PATH variable.

How to install and configure LAMP on ubuntu 12.04

Could somebody please tell me how to install and configure LAMP on ubuntu 12.04 ? Is there a package similar to WAMP Server that is all-in-one ? I have tried to install from command line ,PHP,MySQL work but apache gives me this after sudo service apache2 restart
* Restarting web server apache2
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
And I think probably I did something wrong when installing !
Thank you !
From this tutorial,
Run this commands in Ubuntu Terminal-
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
For Checking-
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'
If u get-
Your PHP installation is working fine.
Then you are done.
You can follow tutorial from below link to setup LAMP on your Ubuntu 12,
http://technarco.com/ubuntu-linux/how-install-lamp-ubuntu-12
Enjoy, :)
To resolve this error, you need to stop other process using this port.
In some of cases it is nginx. you can stop it
sudo /etc/init.d/nginx stop
you can install lamp server using Tasksel (Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated “task” onto your system. This program is used during the installation process, but users can also use tasksel at any time)
check this post http://wiki.workassis.com/ubuntu-install-lamp-using-tasksel/

Resources