How to stop greengrass core? - aws-iot

I have installed greengrass core software and started it via:
sudo tar -xzvf greengrass-OS-architecture-1.11.0.tar.gz -C /
sudo tar -xzvf hash-setup.tar.gz -C /greengrass
cd /greengrass/certs/
sudo wget -O root.ca.pem https://www.amazontrust.com/repository/AmazonRootCA1.pem
cd /greengrass/ggc/core/
sudo ./greengrassd start
Verified that process is started via:
ps aux | grep PID-number
ps aux | grep -E 'greengrass.*daemon'
How to stop greengrass core?

For this, you need to run the following commands,
cd /greengrass-root/ggc/core/
sudo ./greengrassd stop

Related

How to find ngrok installation path?

I am using Ubuntu 18.04 I have installed ngrok using below command:
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
It is installed fine and is also working fine. I am now creating a systemd service for it. For that I need to know the installation path of ngrok. I did which ngrok, it shows me the path /usr/local/bin/ngrok. Where is its config file stored?

Unable to access fsx shared volume after ubuntu 18.04 reboot

Previously, I had a fsx volume mounted on /shared directory.
However, Ubuntu 18.04 + fsx has some bug which causes reboot of the instance to unmount the fsx volume
Temporary solution:
Mount the fsx volume again
wget -O - https://fsx-lustre-client-repo-public-keys.s3.amazonaws.com/fsx-ubuntu-public-key.asc | sudo apt-key add -
sudo bash -c 'echo "deb https://fsx-lustre-client-repo.s3.amazonaws.com/ubuntu bionic main" > /etc/apt/sources.list.d/fsxlustreclientrepo.list'
sudo apt update -y
sudo apt install -y lustre-client-modules-$(uname -r)
sudo mount -t lustre -o noatime,flock fs-<id of the fsx>.fsx.us-east-1.amazonaws.com#tcp:/fsx /shared
ubuntu#<>:~$ ls /shared/
DeepLearningExamples checkpoint checkpoints checkpoints-1.data-00000-of-00001 checkpoints-1.index conda_tf25 conda_tf25_hvd deep-learning-models nccl_hosts
However, cleaner solution would not require this re-mounting of fsx volume after instance reboot.

unable to run redis with custom config file , I am changing dump.rdb file to resrore.rdb which is a backup from another machine

redis dir is /var/lib/redis and dbfilename is dump.rdb and I have restore.rdb backup whichi is from another machine, I tried to replace dump.rdb with restore.rdb but after starting redis it is overwritten to previous steps , so I have changed my dbfilename to restore.rdb and restarted the server but dbfilename is same as before if check in redis-cli
steps I followed
sudo /etc/init.d/redis-server stop
sudo mv /var/lib/redis/dump.rdb /var/lib/redis/dump.rdb.bak
sudo cp restore.rdb /var/lib/redis/dump.rdb
sudo redis-server config/redis.conf
Once server is started dump.rdb is overwritten to previous state. So, instead replace dump.rdb I tried alternative method
sudo /etc/init.d/redis-server stop
sudo cp restore.rdb /var/lib/redis/dump.rdb
and then changed dbfilename to restore.rdb in redis.conf
then restarted the redis
sudo redis-server config/redis.conf.
then I entered into redis-cli and to check config and I realised that config hasn't changed
redis server version:
Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3
the issue is redis server is running in background even after killing it with below command
sudo /etc/init.d/redis-server stop
so you need to make sure you stop redis server is killed
sudo /etc/init.d/redis-server stop
ps aux | grep redis-server | awk '{ print $2 }'| xargs kill -9
above commands will kill all redis related server then
sudo mv /var/lib/redis/dump.rdb /var/lib/redis/dump.rdb.bak
sudo cp restore.rdb /var/lib/redis/dump.rdb
sudo redis-server config/redis.conf

How to install nexus on ubuntu-18.04

I need help in installing nexus-oss on ubuntu18.04. I am not able to find any apt-get commands on internet.
I tried to search for nexus packages in "sudo apt-get search nexus", but could not get a proper nexus version package.
I have browsed over the net, where the commands are available for centos7 but not for Debian os.
In sonatype documentation, the steps are present to create repository manager on ubuntu, is it the same as installing nexus on ubuntu?
Install Java
$ sudo apt-get update
$ sudo apt install openjdk-8-jre-headless -y
Download Nexus
$cd /opt
$ sudo wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz
$ sudo tar -zxvf nexus-3.16.1-02-unix.tar.gz
$ sudo mv /opt/nexus-3.16.1-02 /opt/nexus
As a good security practice, it is not advised to run nexus service as root. so create a new user called nexus and grant sudo access to manage nexus services.
$ sudo adduser nexus
Set no password for nexus user and enter below command to edit sudo file
$sudo visudo
Add the below line and Save.
nexus ALL=(ALL) NOPASSWD: ALL
Change file and owner permission for nexus files
$ sudo chown -R nexus:nexus /opt/nexus
$ sudo chown -R nexus:nexus /opt/sonatype-work
Add nexus as a service at boot time
Open /opt/nexus/bin/nexus.rc file, uncomment run_as_user parameter and set it as following.
$ sudo vim /opt/nexus/bin/nexus.rc
run_as_user="nexus" (file shold have only this line)
Add nexus as a service at boot time
$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
Log in as a nexus user and start service
$ su - nexus
$ /etc/init.d/nexus start
Check the port is running or not using netstat command
$ sudo netstat -plnt
Allow the port 8081 and access the nexus http://:8081
Login as a min default username and password is admin/admin123

How to fix/reinstall scikit-learn after installing only for root from source

I've installed scikit-learn 0.15.2 from source on Fedora 20 but only for root.
Here is what I've done:
$ sudo yum install gcc gcc-c++ numpy python-devel scipy
$ cd ~/Downloads/
$ git clone https://github.com/scikit-learn/scikit-learn
$ cd scikit-learn
$ sudo python setup.py install
This installed the software fine but only for root. I forgot about
$ python setup.py build
before the
$ sudo python setup.py install
How do I fix this so all users can use scikit-learn? Not even sure where to even start with this. Help is much appreciated.
The fix to this was quite simple. I looked at the output of the commands I used to install it and figured out that the scikit-learn was installed to
/usr/lib64/python2.7/site-packages/sklearn/
The package worked for root but not for other users so it may be permissions. I checked the permissions on the folder above and as expected only root had access. Other packages in site-packages folder had only read permissions for other users so I thought I'll do the same for this one.
$ cd /usr/lib64/python2.7/site-packages/
$ sudo chmod 755 sklearn
$ cd sklearn
$ sudo find . -type f -exec chmod 644 {} \;
$ sudo find . -type d -exec chmod 755 {} \;
To make sure it all runs as it should
$ nosetests -v sklearn
Victory. Hope it helps somebody.

Resources