cannot access jupyter notebook on ec2 instance after installing virtualenv - amazon-web-services

My jupyter notebook running from an ec2 instance has been working with no issues until I installed virtualenv using this command:
sudo apt install virtualenv
Since then, I cannot access jupyter on my browser. I have tried uninstalling virtualenv and restarting the instance, to no avail. I also tried to see if jupyter is running with this command:
sudo lsof -i -P -n | grep LISTEN
Which returned this:
jupyter-n 1433 ubuntu 7u IPv4 24133 0t0 TCP *:8888 (LISTEN)
I also tried doing a wget on local, which got me this error:
Connecting to localhost (localhost)|127.0.0.1|:8888... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.
So I assume that the server is running, I just broke something inside, possibly a dependency or some sort of configuration. Is there anything else I can do to troubleshoot the problem?

Related

Why start script is not working to display Hello World in AWS EC2 instance

What is the issue with below script?
I cannot access the site and shows me "This site can’t be reached" error
#!/bin/bash
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd.service
systemctl start httpd.service
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
The correct UserData is (you have also space at the very beginning):
#!/bin/bash
# Use this for your user data (script from top to bottom)
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
You will also need to make sure that the instance is in a public subnet, has public IP and its security group allow connections to port 80.
Thank you all for response.
I don't know much about linux commands. But I did terminate the instance and created again with below user data and found working. Same user data was used earlier also but didn't worked. Also set inbound rules to allow public IP with port 80 also. But didn't work.
So finally I did terminate and recreate instance which is working.
#!/bin/bash
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
Most modern browsers will automatically redirect HTTP traffic to HTTPS and hide the protocol. When doing a simple test like this where you won't be using HTTPS due to not having a certificate, it might be required to manually edit the URL to force it back to HTTP. This was my issue.
Thus if you put your cursor in the URL bar
change that to
now you get
Also instead of the browser you can use a command like tool like curl and skip the HTTPS redirect issue.

Permission denied (publickey,gssapi-keyex,gssapi-with-mic). GCP

I launched a VM with CentOS 7. I configured a GUI and a xrdp with the next .sh file:
#!/bin/sh
#Install​ EPEL and nux Desktop repository rpms
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
#Install​ xfce desktop to get the graphical user interface
yum groupinstall -y "Xfce"
#command​ to change the reboot from CLI to GUI
ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target
#create xfce clients
echo "xfce4-session" > ~/.Xclients
chmod a+x ~/.Xclients
#Install​ the xrdp
yum -y install xrdp tigervnc-server
#start​ the xrdp service
systemctl start xrdp.service
#enable​ the xrdp service
systemctl enable xrdp.service
Everything works fine, i can reach that VM via rdp from my computer, but when i'm in the vm and i try to acces to another vm's in the same project this error appear:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
But it only happens when i try with the vm terminal, if i access from the google ssh client i can access to the other virtual machines without problem.
Another thing: I access to the VM rdp with root user, this could be the problem?
Any ideas?

Linode/Django Can't see site when I runserver at ip:8000

I had started a fresh linode running ubuntu 19.04 and the first time I used the directions at:
https://www.rosehosting.com/blog/how-to-install-mezzanine-cms-on-ubuntu-18-04/
To install Mezzanine CMS it worked just fine, I could run the runserver command and see the django website. Eventually it started giving me a problem after trying 50 ways to deploy the site using apache and mod_wsgi.
I gave up and rebuilt the server and then still couldn't see the new install at the IP when I ran run server. I figured maybe it was because I accidentally installed some things using "python" and others with "python3" so I rebuilt the server.
This third time I followed the direction perfectly, the only difference is I didn't install a mysql server just kept the default SQLlite server and created a DB and Django Superuser.
I have added my ip as a host in settings.py and local_settings.py
I have already ran makemigrations and migrate
I did check to see if maybe the IP had changed when I rebuilt, it hadn't
My local environment on my laptop works fine, just not the linode
Any suggestions on anything I'm missing?
Deployment Guide
Step 1 (Installation)
Install apache2 mod_wsgi
Install virtualenv
Install virtualenv
Install Nginx for asynchronous event-driven approach to handle multiple client requests
Install mysql
sudo apt-get update
sudo apt-get install python3-pip python3-dev apache2 libapache2-mod-wsgi-py3
sudo apt-get install virtualenv ufw
sudo apt-get install nginx
sudo apt-get install mysql-server libmysqlclient-dev
sudo mysql_secure_installation
Step 2 (Apache & Hostname & User)
Set hostname and add it into /etc/hosts with hostname and your Server IP
Create new user and give add to the group sudo for safety
sudo adduser username
sudo usermod -aG sudo
Enable SSH authentication for login & Edit default port of ssh in /etc/ssh/sshd_config. https://askubuntu.com/questions/1074034/not-able-to-change-ssh-port-on-ubuntu-18-04-1-lts
Edit /etc/apache2/site-availabledefault-000.conf for your new Django configuration
Step 3 (Firewall)
sudo ufw allow 8000
sudo ufw allow http
sudo ufw allow ssh
sudo ufw default allow outgoing
sudo ufw default deny incoming
Enable all other required port numbers
ssh sudo ufw enable
Step 4 (Django configuration)
Chown static and media forlders and edit it's permission recursively
Add allowed host in settings.py
Checkout deployment checklist in django official website and do it.
Step 5 (Please checkout)
For apache configuration please visit https://pythonprogramming.net/deploying-to-server-django-tutorial/
Edit the path given in your apache configuration (path for WSGI Script,python-path, python-home ) if any errors found like Internal server error, miss configuration etc
For reference of python-home path please refer Get virtualenv's bin folder path from script
You can also add python-path to WSGIDaemonProcess
Additionally, you can visit puttygen for public and private key generation to login through SSH
For this particular problem turned out I just needed to suddenly bind dev server to 0.0.0.0
the command to do so was
python manage.py runserver 0.0.0.0:8000
Rinshans answers is definetley the details for deployment, I've followed those steps just kept making some mistake in the config and wsgi scripts. I'm going to try deploying with Gunicorn or use the Fabric self-deployment tools built in to Mezzanine CMS, just haven't done so yet.

UI of IPA server is not coming up on AWS ec2 instance?

I have installed the IPA server on AWS EC2 instance by the following method:
Updated the /etc/hosts file
Installed the software:
yum install ipa-server ip-server-dns bind bind-dyndb-ldap yum install ipa-server-dns
iptables --flush
firewall-cmd --permanent --add-port={80/tcp,443/tcp,389/tcp,636/tcp,88/tcp,464/tcp,53/tcp,88/udp,464/udp,53/udp,123/udp}
firewall-cmd --reload
Ran the following command:
ipa-server-install —setup-dns
After successful installation ran kinit admin
I am still unable to see the ui in my browser.
When I checked it found out that dirsrv and ipa_memcached services are not running. How can I enable those services and see the IPA server UI?

sudo: stop: command not found

I'm running a shiny app on an amazon web services instance using shiny-server. I wanted to stop the shiny-server in order to set up password protection but when I was following a protocol that said to type sudo stop shiny-server I got this error sudo: stop: command not found.
I tried to look into it and tried to install sudo apt-get install upstart-sysv but now my error is stop: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused.
the aws instance is ubuntu 16.04, any help is appreciated
You should use sudo systemctl stop shiny-server
Most major Linux distros, including Ubuntu 15.04+, now use systemd for management and configuration.
Earlier versions of Ubuntu used upstart (where the command was sudo stop shiny-server).
For more, see shiny-server documentation.