centos7 cockpit 176 can't add remote hosts - centos7

I set up a 01-machines.json with one host (server0), I can ssh to server0 from the management node (master0). I get an error in the UI saying A compatible version of Cockpit is not installed on 192.168.66.17. It has the same exact version, so the error is misleading. I can reach the UI on server0:9090 with the same creds (cockpit/password), no that isn't the password.
{
"server0": {
"address": "192.168.66.17",
"visible": true,
"color": "green"
}
}
I don't see anything in the logs on master0 or server0 to see what is happening. The user I connect with in the UI is the same on server0, it is in the wheel group and has passwordless sudo
# ssh cockpit#192.168.66.17
cockpit#192.168.66.17's password:
Last login: Wed Oct 24 14:16:18 2018 from 192.168.0.20
[cockpit#app-node-0 ~]$ sudo su -
Last login: Wed Oct 24 14:16:58 UTC 2018 on pts/1
[root#app-node-0 ~]#

I had the same problem, and solved with this:
In master server, I installed the dashoard.
In CentOS the you can install with:
sudo yum install cockpit-dashboard
This will enable the dashboard and allow you to add new server from dashboard UI.
In all other servers, you have to install the cockpit following the official doc:
Official doc to install Dockpit
If you are running a centOS, just run:
sudo yum install cockpit
sudo systemctl enable --now cockpit.socket
sudo firewall-cmd --permanent --zone=public --add-service=cockpit
sudo firewall-cmd --reload
After this, in dashboard on master server you will be able to add the new server
With this aproach, you don't need to use the /etc/cockpit/machines.d/ json files

So, just installing cockpit doesn't include the dashboard, you need to install cockpit-dashboard as well.

Related

Can't install UFW on Amazon Linux server

I'm trying to install UFW on my amazon linux server with yum and here's what I'm getting:
[root#ip-XXX-31-43-YYY ~]# sudo yum install ufw
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No package ufw available.
Error: Nothing to do
[root#ip-XXX-31-43-YYY ~]#
What am I doing wrong?
I can't install via apt-get.
There is no ufw package for Yum.
Lighten the load on your server, and don't install a firewall on it. Instead, control which ports are open in an AWS Security Group.
Here is the easiest way to install ufw in Amazon Linux 2.
Install UFW on Amazon Linux 2
Step 1. Update Amazon Linux 2 system packages.
sudo yum update
Step 2. Install and enable epel repository on Amazon Linux 2.
sudo amazon-linux-extras install epel
Step 3. Now, install UFW.
yum install --enablerepo="epel" ufw
Step 4. To check the version and installation as well, run:
ufw --version
Output:
ufw 0.35
Copyright 2008-2015 Canonical Ltd.
And B0o0ommm. UFW is installed... Here are some more steps to enable the UFW before using it.
Step 5. If the installation is fine you can enable it.
sudo ufw enable
Step 6. Check the status with:
sudo ufw status

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?

ec2 user data script is only partialy excecuted

I am using ec2 instances with ubuntu 18 ami,
with user data script as follows:
#!/bin/bash
sudo apt-get update -y
sudo apt-get install python-pip -y
sudo apt-get install awscli -y
mkdir /home/ubuntu/dir
aws s3 sync s3://art-meta-data ./art-meta-data
the script it only partially executed, It installed pip, performs apt-get update, installed the awscli, but does not sync the bucket and does not create the directory.
I don't get any errors (maybe I don't look the right place?) and when I try to create the dir and sync the bucker via ssh, it works perfectly, meaning the s3 permissions and os permissions are fine.
What can be the issue here? What else should I check?
edit:
I found this - explaining how to make your script run each time you stop and start the instance, but without explanation why the added meta coding changes anything. can anyone point me to some reference for why this script works differently than just regular bash script?
It would be better to describe the full path on the sync command to avoid being created in the wrong place.
#!/bin/bash
sudo apt-get update -y
sudo apt-get install python-pip -y
sudo apt-get install awscli -y
mkdir /home/ubuntu/dir
aws s3 sync s3://art-meta-data /home/ubuntu/dir/art-meta-data
You can check the EC2 system logs to see the output of the failed command. That is really the only way for you to debug your an issue within your user data script.
Double check your instance profile has access to the bucket and that you are using the correct arn to reference the bucket
If you run sudo cat /var/log/cloud-init-output.log you can see the log output of everything that happened while the ec2 user-data you supplied was run. Here's what you'd likely see if you did that:
mkdir: cannot create directory '/home/ubuntu/dir': No such file or directory
Jul 16 18:57:21 cloud-init[2471]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Jul 16 18:57:21 cloud-init[2471]: cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
Jul 16 18:57:21 cloud-init[2471]: util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
ci-info: no authorized ssh keys fingerprints found for user ec2-user.
Cloud-init v. 19.3-45.amzn2 finished at Sat, 16 Jul 2022 18:57:21 +0000. Datasource DataSourceEc2. Up 121.29 seconds
It appears that mkdir fails because /home/ubuntu doesn't yet exist at the time the ec2 user data script runs. One way to solve this would be to move the creation of the folder to /etc/profile.d.
To do this, you could modify your user data script as follows:
echo "mkdir -p /home/ubuntu/dir && aws s3 sync s3://art-meta-data /home/ubuntu/dir/art-meta-data" >> /etc/profile.d/sync_bucket.sh
Files in /etc/profile.d/ are run when a user logs in so you're guaranteed the existence of /home/ubuntu folder and the sync will occur on each login.

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.