Nginx doesnt work - nginx

In ubuntu 12.04 (server):
sudo apt-get install libpcre3 libpcre3-dev zlib1g-dev
wget http://nginx.org/download/nginx-1.5.6.tar.gz && tar zxvf nginx-1.5.6.tar.gz && cd nginx-1.5.6 && ./configure && make && sudo make install
Then I try:
sudo service nginx start
or
nginx -s reload
and many others that I find in google - all of them doesnt works. (nginx: unrecognized service, no command found, etc)
How to start nginx?

for you guys, who used nginx installation via passenger:
$ wget -O init-deb.sh https://gist.githubusercontent.com/rschmitty/5891885/raw/9b737a42e950581f16ed3074c69f5bcb920f24cb/660-init-deb.sh
$ sudo mv init-deb.sh /etc/init.d/nginx
$ sudo chmod +x /etc/init.d/nginx
$ sudo /usr/sbin/update-rc.d -f nginx defaults
It enables standard service nginx start|stop|restart|reload commands

You can install nginx like you installed those libraries. The only reason to compile it manually is if you want a really new feature or security fix.
sudo apt-get install nginx
It should automatically start nginx. If not you may start it manually.
sudo /etc/init.d/nginx start

Related

How can i uninstall Ant Media server from ubuntu 19.10?

I have tried to check in Git Repository of ant media server, but didn't get any suggestion over there. I am only getting suggestion for installation.
If you want to remove fully, you should follow below steps:
sudo rm -rf /usr/local/antmedia/
sudo userdel antmedia
Remove antmedia service as below
For AMS v1.9.1 and before versions:
sudo update-rc.d antmedia disable
sudo rm /etc/systemd/system/antmedia
sudo systemctl daemon-reload
sudo systemctl reset-failed
For AMS v2.0.0 and after versions:
sudo rm /etc/systemd/system/antmedia.service
sudo systemctl daemon-reload
sudo systemctl reset-failed

How to mount Cloud Filestore in GCP AI platform Jupyter notebook?

I want to mount a Cloud Filestore instance in a GCP AI Platform Jupyter notebook instance so that I don't have to upload all of my data into the notebook.
I followed the instructions at https://cloud.google.com/filestore/docs/mounting-fileshares, but get these error messages:
root#0084329abd1b:/home# mount <IP_ADDRESS>:/streams cfs
mount.nfs: rpc.statd is not running but is required for remote locking.
mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
root#0084329abd1b:/home# mount -o nolock <IP_ADDRESS>:/streams cfs
mount.nfs: Operation not permitted
From your terminal, you can do something like this.
mkdir des_bucket
gcsfuse --debug_gcs --implicit-dirs src_bucket des_bucket
Create a Filestore instance link
Crerate a Google VM instance link
Create a Notebook AI instance link
On the VM instance run the commands:
sudo apt-get -y update
sudo apt-get -y install nfs-common
sudo mkdir test
# fileshare remote target
sudo mount 111.11.111.11:/fileshare test
sudo chmod go+rw test
echo 'This is a test' > test/testfile
ls test
#testfile
On the Notebook AI instance run the commands link:
sudo apt-get -y update
sudo apt-get -y install nfs-common
sudo mkdir test
# fileshare remote target
sudo mount 111.11.111.11:/fileshare /test
ls test
#testfile
You can also check link

Unable to uninstall nginx on Mac OS X

Output of nginx -v:
nginx version: nginx/1.14.0.
After running brew uninstall nginx or brew remove nginx, it gives error:
Error: No such keg: /usr/local/Cellar/nginx
I have tried :
rm -f /usr/local/sbin/nginx
rm -f -R /usr/local/etc/nginx
rm -r /usr/local/opt/nginx
But still nginx -v giving output: nginx version: nginx/1.14.0
How can I remove the nginx installation?
Check path with which nginx Then, you can remove from that path.
Update your local filesystem db on Mac, this will take of any links in the system,
sudo /usr/libexec/locate.updatedb

kibana-time-plugin downloaded but bower install not working and even kibana not working

I wanted to have a Widget to view and edit the time range from within dashboards of kibana. So after lot of research i found a plugin as Kibana-time-plugin. Ref: https://github.com/nreese/kibana-time-plugin
Currently i am using kibana 5.4.0 in my local. After installing the plugin i have tried "bower install" as per the command specified in git page. But getting an error as :-
$ bower install
/usr/bin/env: ‘node’: No such file or directory
And even if Kibana is not running and giving an error as below attached image:-
kibana5.4.0
Can anyone Guide me on this ?
Thanks in Advance !!!!!!!!!!!!!!!
I think the optimization failures may be due to file permissions, the plugin files need to be accessible by the kibana user. Specifically check this instruction:
Installing plugins with linux packages
Here is a complete script that worked for me. I am new to Kibana and Kibana plugins so any feedback appreciated. Two important notes:
1) I am pulling the zip file from S3 so you will need to edit that.
2) Be sure to restart kibana afterwards and check the logs
#!/bin/bash
# install nodejs and npm
sudo curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -
sudo yum install -y nodejs
sudo npm install -g bower
# copy the plugin zip and unzip it and fix the name
cd /usr/share/kibana/plugins
sudo aws s3 cp s3://<YOUR-BUCKET>/kibana-time-plugin-master.zip .
sudo unzip kibana-time-plugin-master.zip
sudo mv kibana-time-plugin-master kibana-time-plugin
# install the plugin
cd /usr/share/kibana/plugins/kibana-time-plugin
sudo sed -i -e 's/5.0.0/5.4.2/' package.json
sudo chown -R kibana:kibana *
sudo mkdir -p /home/kibana
sudo chown -R kibana:kibana /home/kibana
sudo -u kibana bower install

Docker Timezone in Ubuntu 16.04 Image

I have created a Docker container using the Ubuntu 16.04 image.
docker run -it -d --name containername -v /var/www/public --privileged ubuntu
after creating the container, I checked the date inside the container:
$ date
Tue Oct 25 08:10:34 UTC 2016
But, I need it to use the Asia/Kolkata timezone. So I tried changing the /etc/timezone file, then docker stop and docker start the container, but it doesn't work. It still shows the same time.
How can I change the time zone in the Docker container after creating it?
Updating /etc/timezone is the usual way, but there's a bug in Xenial which means that doesn't work.
Instead you need to create a link from the desired timezone to etc/localtime:
FROM ubuntu:xenial
RUN ln -fs /usr/share/zoneinfo/US/Pacific-New /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
In ubuntu 16.04 i was missing tzdata so i had to install it. Working solution was
ENV TZ 'Europe/Tallinn'
RUN echo $TZ > /etc/timezone && \
apt-get update && apt-get install -y tzdata && \
rm /etc/localtime && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
apt-get clean
Try:
echo "Asia/Kolkata" > /etc/timezone
rm -f /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
You have to do rm /etc/localtime because of the Ubuntu bug.
As said here, the secret is that dpkg-reconfigure tzdata simply creates /etc/localtime as a copy, hardlink or symlink (a symlink is preferred) to a file in /usr/share/zoneinfo. So it is possible to do this entirely from your Dockerfile. Consider:
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
And as a bonus, TZ will be set correctly in the container as well.
This is also distribution-agnostic, so it works with pretty much anything Linux.
My issue has been solved with this very simple solution (https://serverfault.com/a/826222) : Add timezone in environment variable.
The command is docker run -e TZ=Europe/Amsterdam ...
Or, using docker-compose, like I do :
version: '3'
services:
web:
build: ./app
ports:
- ...
volumes:
- ...
environment:
- TZ=Europe/Paris
In my case, no more tzdata needed, or volume share with /etc/timezone & /etc/localtime.
Hope it helps !
If you use docker-compose, just add one line to your docker-compose.yml file.
version: '3'
services:
ubuntu-local:
image: ubuntu:16.04
restart: on-failure
command: python3 run_my_code.py
working_dir: /code
volumes:
- ./code:/code
- /etc/localtime:/etc/localtime:ro # <--add this line to set timezone
environment:
- PYTHONUNBUFFERED=1
I took this approach:
Copy file /etc/localtime somewhere.
Open it and find the this number (highlighted with yellow)
-3 corresponds to Moscow time. For Berlin set -1 . If you need positive value, set UTC2
Copy and modify /etc/timezone according to your time zone.
Link them to your container
Result:
SOLVED:
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y software-properties-common apt-utils locales tzdata
RUN echo "tzdata tzdata/Areas select Europe" > timezone.txt
RUN echo "tzdata tzdata/Zones/Europe select Rome" >> timezone.txt
RUN debconf-set-selections timezone.txt
RUN rm /etc/timezone
RUN rm /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata
Simply map the volume while running docker container
-v /etc/timezone:/etc/timezone:ro
I am also experiencing this issue for a Ubuntu 18.04 docker container. Since tzdata package is not installed. There is no /usr/share/zoneinfo dir inside the docker. We need to first install tzdata and use dpkg-reconfigure to set the timezone. The following docker command works for me:
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata
Dockerfile:
RUN apt-get update && \
apt-get install -yq tzdata && \
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata
Reference: https://dev.to/0xbf/set-timezone-in-your-docker-image-d22
Note: Need to run it as root user

Resources