Root and instance creator password? - google-compute-engine

I use the Google Compute Engine Web Console to remote into my instance. I can perform root operations using "sudo", but what if I wanted to "su" to root?
I created a user "test", and now want to log-in as "test" -- this doesn't work as I have not yet generated SSH keys. Where do I find these keys for instance creator and/or root as well?
Also, I used a Debian image, but few commands appear to be installed by default. For instance, locate, updatedb, etc are missing? How do I get these?

You asked several questions in a single post; I'll answer them in order.
(1) I use the Google Compute Engine Web Console to remote into my instance. I can perform root operations using "sudo", but what if I wanted to "su" to root?
Use: sudo su -
(2) I created a user "test", and now want to log-in as "test" -- this doesn't work as I have not yet generated SSH keys. Where do I find these keys for instance creator and/or root as well?
You can ssh via gcloud compute ssh or by clicking on the "SSH" button on the web UI, and then run: sudo su test.
(3) Also, I used a Debian image, but few commands appear to be installed by default. For instance, locate, updatedb, etc are missing? How do I get these?
To install missing packages, you'll have to use the standard Debian command apt-get to install the packages, e.g.:
$ sudo apt-get install [name-of-package]
To find a package name using keywords, use:
$ apt-cache search [keyword]
Note: the first thing you want to do on a brand-new instance is to update your package metadata cache by running:
$ sudo apt-get update

https://cloud.google.com/solutions/set-up-postgres
The above link helped me get over a similar issue described above but in the postgres user setup context. Wasn't covered in any of the other posts so thought to share here.

Related

Signature verification failed when installing MySQL 5.7.29 on Suse Linux Leap 15.1

I want to install MySQL community edition 5.7.29 on OpenSuse Linux leap 15.1 as following:
Download the file: mysql-5.7.29-1.sles12.x86_64.rpm-bundle.tar;
untar the file then get 8 files
>mysql-community-client-5.7.29-1.sles12.x86_64.rpm
>mysql-community-common-5.7.29-1.sles12.x86_64.rpm
>mysql-community-devel-5.7.29-1.sles12.x86_64.rpm
>mysql-community-embedded-5.7.29-1.sles12.x86_64.rpm
>mysql-community-embedded-devel-5.7.29-1.sles12.x86_64.rpm
>mysql-community-libs-5.7.29-1.sles12.x86_64.rpm
>mysql-community-server-5.7.29-1.sles12.x86_64.rpm
>mysql-community-test-5.7.29-1.sles12.x86_64.rpm
install the 4 files rpm using the command:
>sudo zypper install mysql-community-{server,client,common,libs}-*
Then the error message shows as below:
>mysql-community-common-5.7.29-1.sles12.x86_64.rpm:
Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
>Looking for gpg key ID 5072E1F5 in cache /var/cache/zypp/pubkeys.
Repository Plain RPM files cache does not define additional
'gpgkey=' URLs.
mysql-community-common-5.7.29-1.sles12.x86_64 (Plain RPM files
cache): Signature verification failed [4-Signatures public key is
not available]
>Abort, retry, ignore? [a/r/i] (a):
Any response will be appreciated.
Just write i to bypass this issue and successfully complete installation.
The issue because by default OpenSUSE use downloads.opensuse.org repository that seems to use proxy to nearest server mirror, but the problem is that it seems some mirrors does not update something on his servers so you found messages like "Signature verification failed".
You can try several solutions:
Use some VPN service to change your IP location to find a chance that download.opensuse.org will redirect you on some good mirror.
Change "download.opensuse.org" domain in the repo configuration in the /etc/repo.d (or /etc/zypp/repo.d) to some other server from the list: https://mirrors.opensuse.org/list/15.0.html and put it into the repository files (/etc/repo.d/* or /etc/zypp/*), e.g. http://nrt.edge.kernel.org/opensuse (instead of http://download.opensuse.org).
Also you can change source server even in the OpenSUSE installation mode while use graphical install. For that you should cancel graphical install and when text mode menu opened, in the "Expert mode" you can edit configuration from the console. In the console you can't use "vi" so use "sed" command to change the file contents.
Scan configs:
grep "downloads.opensuse.org" -r /etc
Change content for every file:
sed -i s/downloads.opensuse.org/nrt.edge.kernel.org\/opensuse/g /etc/products.d/openSUSE.prod
...

Using a connector with Helm-installed Kafka/Confluent

I have installed Kafka on a local Minikube by using the Helm charts https://github.com/confluentinc/cp-helm-charts following these instructions https://docs.confluent.io/current/installation/installing_cp/cp-helm-charts/docs/index.html like so:
helm install -f kafka_config.yaml confluentinc/cp-helm-charts --name kafka-home-delivery --namespace cust360
The kafka_config.yaml is almost identical to the default yaml, with the one exception being that I scaled it down to 1 server/broker instead of 3 (just because I'm trying to conserve resources on my local minikube; hopefully that's not relevant to my problem).
Also running on Minikube is a MySQL instance. Here's the output of kubectl get pods --namespace myNamespace:
I want to connect MySQL and Kafka, using one of the connectors (like Debezium MySQL CDC, for instance). In the instructions, it says:
Install your connector
Use the Confluent Hub client to install this
connector with:
confluent-hub install debezium/debezium-connector-mysql:0.9.2
Sounds good, except 1) I don't know which pod to run this command on, 2) None of the pods seem to have a confluent-hub command available.
Questions:
Does confluent-hub not come installed via those Helm charts?
Do I have to install confluent-hub myself?
If so, which pod do I have to install it on?
Ideally this should be configurable as part of the helm script, but unfortunately it is not as of now. One way to work around this is to build a new Docker from Confluent's Kafka Connect Docker image. Download the connector manually and extract the contents into a folder. Copy the contents of this to a path in the container. Something like below.
Contents of Dockerfile
FROM confluentinc/cp-kafka-connect:5.2.1
COPY <connector-directory> /usr/share/java
/usr/share/java is the default location where Kafka Connect looks for plugins. You could also use different location and provide the new location (plugin.path) during your helm installation.
Build this image and host it somewhere accessible. You will also have to provide/override the image and tag details during the helm installation.
Here is the path to the values.yaml file. You can find the image and plugin.path values here.
Just an add-on to Jegan's comment above: https://stackoverflow.com/a/56049585/6002912
You can choose to do the Dockerfile below. Recommended.
FROM confluentinc/cp-server-connect-operator:5.4.0.0
RUN confluent-hub install --no-prompt debezium/debezium-connector-postgresql:1.0.0
Or you can use a Docker's multi-stage build instead.
FROM confluentinc/cp-server-connect-operator:5.4.0.0
COPY --from=debezium/connect:1.0 \
/kafka/connect/debezium-connector-postgres/ \
/usr/share/confluent-hub-components/debezium-connector-postgres/
This will help you to save time on getting the right jar files for your plugins like debezium-connector-postgres.
From Confluent documentation: https://docs.confluent.io/current/connect/managing/extending.html#create-a-docker-image-containing-c-hub-connectors
The Kafka Connect pod should already have the confluent-hub installed. It is that pod you should run the commands on.
The cp kafka connect pod has 2 containers, one of them is a cp-kafka-connect-server container.That container has confluent-hub installed.You can login into that container and run your connector commands there.To login into that container, run the following command:
kubectl exec -it {pod-name} -c cp-kafka-connect-server -- /bin/bash
As of latest version of chart, this can be achieved using customEnv.CUSTOM_SCRIPT_PATH
See README.md
Script can be passed as a secret and mounted as a volume

How to install .deb with dpkg non-interactively?

I'm trying to install a .deb file... for example:
example.deb.
But the program is already installed in an older version on the Debian minimal server.
So doing dpkg -i example.deb is creating a dialog, if i want to keep the configs...
is there any way to do this none interactive?
You can pipe yes into it:
yes | dpkg -i package.deb
man yes
You seem to be looking for
dpkg --force-confold -i package.deb
to specify that dpkg should prefer the existing, old configuration files in the case when there is a conflict.
More broadly, the proper solution depends on how desperate you are to avoid interactive prompts, and which prompts precisely you want to avoid.
dpkg has a number of options to select a particular behavior for various types of situations. Refer to its man page; scroll to the section on --force-things; one of them is --force-confold, or conversely --force-confnew to always replace any existing configuration file. (Many modern packages have a facility to upgrade any unchanged configurations completely automatically, but manually changed configuration files still require manual updating or merging.)
If you aren't running dpkg directly, apt and friends allow you to pass options to it with
apt install -o Dpkg::Options::="--force-confold" install package
(Yeah, that's a lot of colons. You probably want install -y to avoid interactive prompting by Apt itself, too.)
Setting the environment variable DEBIAN_FRONTEND to the string noninteractive will make Debconf (the configuration management component of Debian) select the default answer for all questions, and disable any prompting.
If the default answers to a package's configuration questions are not suitable, you can preseed Debconf's configuration database with the settings you want. You'll need to install debconf-utils which contains the utility debconf-set-selections. See further its man page and e.g. some sections of https://wiki.debian.org/DebianInstaller/Preseed (though this is rather focused en preseeding the installer, so you can potentially perform an unattended installation of all of Debian).
The problem with
yes | dpkg -i package.deb
is that you can't exactly predict which prompts are going to be shown, depending on the package's and the hosting system's configuration; you might say yes to something you didn't want to, or perhaps tell the system that your domain name or default database user is yes. Debconf was designed to give you very detailed and, for the most part, very safe and robust control over package installation - use that power.

how to save iptables changes in fedora 22

After every restart the changes I make to iptables are lost. I know now that I have to save the changes after making them, but every way of saving I tried so far doesn't work.
I tried the following :
/etc/init.d/iptables save (command not found)
/usr/libexec/iptables.init save (command not found)
/sbin/service iptables save (the service supports only basic lsb actions)
I'm just a basic *nix user, so most of my knowledge is based on uncle Google and I cannot find more solutions at the moment. Any help would be appreciated.
I'm on Fedora 22 64-bit.
As Fedora uses firewalld in recent versions, you need to do it with firewalld commands. Take a look here
If you insist to use iptables, you need to install iptables in order to use iptables-save and iptables-restore commands using dnf install iptables .

Stuff not included in RailsReady?

I tried to install RoR on Ubuntu 12.0.4 using RailsReady(https://github.com/joshfng/railsready). Afterwards I restarted my computer and while typing ruby -v works, typing rails -v returns unrecognized, as does mysql in the terminal. What do I have to do to be able to launch rails and mysql? Do I have to install them individually using sudo even though I've already installed RailsReady? Thanks.
A quick glance at the README and the script itself shows that it gets you ready to install Rails by installing typical packages needed in order to create a Rails-based development environment, and then attempts to install it.
Per #madth3's comment below, lines 176 to 182 of railsready.sh does attempt to install Rails, so look for any error messages when you run that script.
MySQL appears to require separate installation using standard methods appropriate for your system.