Mongodb not starting up after installation - linux

I installed mongodb 5.0.14 on ec2 instance
I followed this tutorial
sudo apt install -y software-properties-common gnupg apt-transport-https ca-certificates
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod
But I get this error on the picture below

Related

Jupyterlab docker container error on starting the container

I have created a notebook Docker file as below to running the JupyterHub and JupyterLab
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install sudo
RUN sudo useradd -m admin
RUN sudo echo -e "admin\nadmin\n" | passwd admin
RUN sudo echo "admin ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER admin
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-utils
RUN sudo apt-get update \
&& sudo apt-get install -y build-essential \
&& sudo apt-get install -y libffi-dev \
&& sudo apt-get install -y libmysqlclient-dev \
&& sudo apt-get install -y libsasl2-dev \
&& sudo apt-get install -y openjdk-8-jdk \
&& sudo apt-get install -y openssh-server \
&& sudo apt-get install -y python-dev \
&& sudo apt-get install -y unzip \
&& sudo apt-get install -y wget \
&& sudo apt-get install -y mysql-client \
&& sudo apt-get install -y git
RUN sudo apt-get install -y libssl-dev libxml2-dev libxslt1-dev zlib1g-dev libkrb5-dev
RUN sudo apt-get update
RUN sudo apt-get install -y python3-pip
RUN sudo apt-get install -y python-pip
RUN sudo apt-get install -y python3-venv
RUN sudo python3 -m venv /opt/jupyterhub/
RUN sudo /opt/jupyterhub/bin/python3 -m pip install --upgrade pip
RUN sudo /opt/jupyterhub/bin/python3 -m pip install wheel
RUN sudo /opt/jupyterhub/bin/python3 -m pip install jupyterhub jupyterlab
RUN sudo /opt/jupyterhub/bin/python3 -m pip install ipywidgets
RUN sudo apt-get install -y curl
RUN sudo apt-get install -y nodejs npm
RUN sudo curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
RUN sudo bash nodesource_setup.sh
RUN sudo apt-get install -y nodejs
RUN sudo npm install -g -y configurable-http-proxy
RUN sudo mkdir -p /opt/jupyterhub/etc/jupyterhub/
RUN cd /opt/jupyterhub/etc/jupyterhub/
RUN sudo /opt/jupyterhub/bin/jupyterhub --generate-config
RUN sudo mkdir -p /opt/jupyterhub/etc/systemd
RUN sudo chown -R admin:admin /opt/jupyterhub
RUN sudo echo "c.Spawner.default_url = '/lab' " >> /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py
RUN sudo echo "c.Authenticator.admin_users = {'admin'} " >> /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py
RUN sudo echo "c.LocalAuthenticator.create_system_users=True" >> /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py
RUN sudo echo -e '[Unit]\nDescription=JupyterHub\nAfter=syslog.target network.target\n\n[Service]\nUser=root\nEnvironment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/jupyterhub/bin"\nExecStart=/opt/jupyterhub/bin/jupyterhub -f /opt/jupyterhub/etc/jupyterhub/jupyterhub_config.py\n\n[Install]\nWantedBy=multi-user.target' >> /opt/jupyterhub/etc/systemd/jupyterhub.service
RUN sudo cp /opt/jupyterhub/etc/systemd/jupyterhub.service /etc/systemd/system/jupyterhub.service
RUN sudo systemctl enable jupyterhub.service
#RUN sudo chown -R admin:admin /home/admin/.cache/pip
RUN sudo /opt/jupyterhub/bin/python3 -m pip install --upgrade setuptools
RUN sudo /opt/jupyterhub/bin/python3 -m pip install ipython==3.2.3
RUN sudo /opt/jupyterhub/bin/python3 -m pip install zipp==1.2.0
RUN sudo /opt/jupyterhub/bin/python3 -m pip install git+https://github.com/as-sher/sparkmagic.git#subdirectory=sparkmagic
RUN sudo /opt/jupyterhub/bin/jupyter-kernelspec install /opt/jupyterhub/lib/python3.5/site-packages/sparkmagic/kernels/sparkkernel
RUN sudo /opt/jupyterhub/bin/jupyter-kernelspec install /opt/jupyterhub/lib/python3.5/site-packages/sparkmagic/kernels/pysparkkernel
RUN sudo sed -i 's|root:x:0:0:root:/root:/bin/bash|root:x:0:0:root:/root:/sbin/nolgin|g' /etc/passwd
WORKDIR /home/admin
#USER root
EXPOSE 8000 2222
CMD SUDO SYSTEMCTL START JUPYTERHUB.SERVICE
When I am running this container as a root user, it is working, but when I am running this with admin (sudo user), I am getting the following error
Failed to mount tmpfs at /run/lock: Operation not permitted
[!!!!!!] Failed to mount API filesystems, freezing.
Freezing execution.
So my concern is that I have to run this container on Kubernetes and I don't want to run it as a root user and with privileged flag.
Is there any way in which I can run the existing docker with non-root user or if we can run the jupyter service without adding systemd.
There are some ways you can try in order to run Docker as a non-root user.
Manage Docker as a non-root user:
If you don’t want to preface the docker command with sudo, create a
Unix group called docker and add users to it. When the Docker daemon
starts, it creates a Unix socket accessible by members of the docker
group.
Create a docker group if there isn’t one:
$ sudo groupadd docker
Add your user to the docker group:
$ sudo usermod -aG docker [non-root user]
Log out and log back in so that your group membership is re-evaluated.
Run the Docker daemon as a non-root user (Rootless mode):
Rootless mode allows running the Docker daemon and containers as a
non-root user to mitigate potential vulnerabilities in the daemon and
the container runtime. Rootless mode does not require root privileges
even during the installation of the Docker daemon, as long as the
prerequisites are met.
Notice however that the second option is currently available as an experimental feature. You can find all the necessary details in the linked docs.
Please let me know if that helped.

Error when trying to install virtualbox-5.1

I'm trying to install Cuckoo (Ubuntu 64 bit) the commands that worked are:
$ sudo apt-get update
$ sudo apt-get install git -y
$ sudo apt-get install python python-pip python-dev libffi-dev libssl-dev -y
$ sudo apt-get install python-virtualenv python-setuptools -y
$ sudo apt-get install libjpeg-dev zlib1g-dev swig -y
$ sudo apt-get install mongodb -y
$ sudo apt-get install postgresql libpq-dev -y
$ echo deb http://http://download.virtualbox.org/virtualbox/debian xenial contrib | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
$ wget -q https://https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
$ wget -q https://virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
and when I executed the following command:
$ sudo apt-get install virtualbox-5.1 -y
I got the following error:
Any help please on how to fix this error?
It would be better if you downloaded the .deb package from the website rather than using apt.

Installing Azure CLI in Dockerfile can't locate package azure-cli

I'm trying to write a dockerfile that will install Azure CLI so that I can run CLI commands in bitbucket pipelines.
However the installation of the CLI always fails:
E: Unable to locate package azure-cli
The command '/bin/sh -c apt-get install azure-cli' returned a non-zero code: 100
Here is my dockerfile
FROM atlassian/default-image:latest
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl
RUN apt-get update
RUN apt-get install -y libssl-dev libffi-dev
RUN apt-get install -y python-dev
RUN apt-get install apt-transport-https lsb-release software-properties-common -y
ENV AZ_REPO $(lsb_release -cs)
RUN echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | tee /etc/apt/sources.list.d/azure-cli.list
RUN apt-key --keyring /etc/apt/trusted.gpg.d/Microsoft.gpg adv \
--keyserver packages.microsoft.com \
--recv-keys BC528686B50D79E339D3721CEB3E94ADBE1229CF
RUN apt-get install azure-cli
CMD ["/bin/bash"]
you need to do apt-get update after importing new package feed to get packages from that feed.

I'm new to Ubuntu and I can't seem to get this Curl command to work. How can I install nodejs 7.x on Ubuntu 16.04?

sudo apt-get update&&sudo apt-get dist-upgrade
sudo apt-get install curl
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
and the curl command fails when trying to enter, says "bash: -d: command error
Solved it, I dunno why but I had to type:
sudo apt-get install -y nodejs
sudo apt-get purge nodejs npm
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
and that seemed to actually install 4.2, remove it, then install 7.x

Proper way to make this a shell script

Hi guys anyone can guide me or re-write my script? well i manually type this code everytime i reinstall.
i want to make this all in just 1 script file only
yum update -y
yum install httpd -y
service httpd start
yum install mysql-server -y && service mysqld start && mysql_secure_installation
yum install php php-mysql -y && service httpd restart
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum check-update && yum install phpMyAdmin -y
vi /etc/httpd/conf.d/phpMyAdmin.conf (Will edit some of line)
yum install git -y && yum install gcc make mysql mysql-devel mysql-server pcre-devel zlib-devel && yum -y install dos2unix gdb nano screen unzip wget zip
yum -y groupinstall Desktop && yum -y install tigervnc-server pixman pixman-devel libXfont
vncpasswd
vi /etc/sysconfig/vncservers
(Will write this on the bottom of vncservers)
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1100x768"
yum -y install xterm && yum -y install subversion && yum install gnome-utils -y && yum -y install nautilus-open-terminal
service vncserver start
chkconfig httpd on && chkconfig mysqld on && chkconfig vncserver on
reboot
=====
Is there anyone can help me to clean up and put that in 1 file only?
in some directory of your choice do touch [script_name].sh then enter the following into the script
#!/bin/bash
#if not sudo or root yum fails
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
yum update -y
yum install httpd -y
service httpd start
yum install mysql-server -y && service mysqld start && mysql_secure_installation
yum install php php-mysql -y && service httpd restart
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm && yum check-update && yum install phpMyAdmin -y
sed -i '24s/Deny from All/Allow from All/' /etc/httpd/conf.d/phpMyAdmin.conf
yum install git -y && yum install gcc make mysql mysql-devel mysql-server pcre-devel zlib-devel && yum -y install dos2unix gdb nano screen unzip wget zip
yum -y groupinstall Desktop && yum -y install tigervnc-server pixman pixman-devel libXfont
vncpasswd
echo VNCSERVERS="1:root" >> /etc/sysconfig/vncservers
echo VNCSERVERARGS[1]="-geometry 1100x768" >> /etc/sysconfig/vncservers
yum -y install xterm && yum -y install subversion && yum install gnome-utils -y && yum -y install nautilus-open-terminal
service vncserver start
chkconfig httpd on && chkconfig mysqld on && chkconfig vncserver on
echo rebooting computer
sleep 5
reboot
After that is done exit the text editor and run the command chmod +x /scriptpath/[script_name].sh and then cd to the directory containing the script and run ./[script_name].sh.

Resources