how to undo "dnf --installroot" command in fedora linux? - fedora

I wanted to install a package under /mnt/data folder to do that i have used this commnad
dnf --installroot=/mnt/data --releasever=/ install package_name
But this command create a whole new linux root folder structure inside /mnt/data folder.
Now i want to undo that is there any way?

Related

how to install mysql to existing docker file

I'm trying to add mysql to a dockerfile. I dont want to use a mysql source docker, I'm using something else as I need ffmpeg/nvidia/asp.net aswell. So I can't simple use a different base image to start from.
So how can I
Add mysql to my docker build file?
Configure it so the data for mysql is in a specific directory (so I can can map outside the docker file)
Have mysql start up but not be the entry point service
Everything I found so far basically say "use this base image". which doesn't help me. I dont want to have mysql separate, just self contained docker image with everything it needs.
TIA
Install mysql
Use apt-get to install packages on debian distro's. Add in your dockerfile the following line:
RUN apt-get update && apt-get install -y mysql-server
Start MySQL
Add to the Dockerfile CMD a prefix where you start mysql in detached mode. Like:
CMD mysql start & # [paste here your default command]`.
This will start mysql and start your app.
Mount directories
Mounting directories is done with the -v flag:
docker run -ti -v <host_dir>:<container_dir> my-image /bin/bash

How can mysql db be restored in dockerfile

I'm trying to restore MySQL DB to a ubuntu docker container which has Apache and MySQL services. Here's my docker file
FROM ubuntu
RUN apt-get update -y
ENV DATABASE_SERVER 'IP'
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get install apache2 -y && apt-get install php7.4 -y && apt-get install mysql-server >
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_RUN_DIR /var/www/html/
COPY ./startup.sh /var/www/
COPY ./db_test.php /var/www/html
COPY ./my_sql_secure.sh /var/www/
COPY ./backup.sql /var/www/html/
RUN bash /var/www/my_sql_secure.sh
COPY ./restoredb.sh /var/www/
CMD bash /var/www/startup.sh
EXPOSE 80
Here's my startup.sh
apache2 -DFOREGROUND | service mysql start | mysql -uroot sentrifugo < /var/www/html/backup.sql
If I run startup.sh without "mysql -uroot sentrifugo < /var/www/html/backup.sql" , the script properly brings up mysql service but when I run with it doesn't run.
From what i know CMD accepts only two commands and running the restoredb.sh after startup.sh replaces it.
I just want to restore the mysql Database and run mysql and apache in foreground. I can't use docker-compose as per the requirement I have.
Could someone please tell me what can be done to achieve it.
Thanks a lot in advance
It really depends on what image you are building FROM, assuming that it is an official MySQL image, you just COPY your backup.sql into the seed folder:
When a container is started for the first time, a new database with the specified name will be created and initialized with the provided configuration variables. Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d. Files will be executed in alphabetical order. You can easily populate your mysql services by mounting a SQL dump into that directory and provide custom images with contributed data. SQL files will be imported by default to the database specified by the MYSQL_DATABASE variable.
(from the MySQL page on DockerHub )
So, change:
COPY ./backup.sql /var/www/html/
...to:
COPY ./backup.sql /docker-entrypoint-initdb.d/
If you are using a custom image, and it seems that you may be, the you might want to have an ENTRYPOINT that executes that import script on startup.
Also, your startup.sh might work with some changes:
service mysql start && \
mysql -uroot sentrifugo < /var/www/html/backup.sql;
apache2 -DFOREGROUND
This will start the MySQL service first, then populate the DB. Then, finally, start up Apache.
One last thing, the preferred form of CMD is the exec form. This would have your CMD look like this:
CMD ["/bin/bash","/var/www/startup.sh"]
(ref: https://docs.docker.com/engine/reference/builder/#cmd)

"Start by creating and opening a systemd socket file for Gunicorn with sudo privileges" (directory to this file does not *appear* to exist)

I am working on a server running ubuntu 18.04. This digital ocean tutorial on django deployment(https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04) is telling me to do the following:
"We’re now finished configuring our Django application. We can back out of our virtual environment by typing:
(env): deactivate" I am familiar with virtual environments, I did this. Now for the part I am not at all familiar with:
"Start by creating and opening a systemd socket file for Gunicorn with sudo privileges:
sudo nano /etc/systemd/system/gunicorn.socket
"
First, since I just deactivated my env, I am now at justin#ubuntu-s-1vcpu-1gb-nyc3-01:~$. If I ls I only see the project folder I created which holds the virtualenv, the python project, manage.py and the static directory. Nowhere can I find this
/etc/systemd/system/
directory and the command they are telling me to use cannot create directories, only files. So I am very confused, any help would be greatly appreciated.
/etc doesn't live inside ~. Try ls /etc to see what's already in that directory. If you need to create that directory, you can do so wih sudo mkdir -p /etc/systemd/system/ (the -p flag is to make sure that, in case systemd is also not present under etc, it will get created).

Conflict installing XMind 3.6.0 from RPM on Fedora 23

I am trying to solve problem installing XMind 3.6.0 RPM on Fedora 23.
I have downloaded the .deb package from XMind webpage.
Than, I have converted it to RPM package with Alien, to be able to install it on Fedora with help of this manual.
sudo alien -r -c xmind-3.6.0-2.x86_64.deb
and than install the generated RPM package
sudo rpm -ivh xmind-3.6.0-2.x86_64.rpm
but I keep getting the error message:
Preparing... ################################# [100%]
file /usr/bin from install of xmind-3.6.0-2.x86_64 conflicts with file from package filesystem-3.2-35.fc23.x86_64
file /usr/lib from install of xmind-3.6.0-2.x86_64 conflicts with file from package filesystem-3.2-35.fc23.x86_64
Does anybody know, how to resolve this conflict?
Thanks,
shimon
I was unable to solve the error described in my post. However, I have found a way to install XMind 7 (3.6.0) on Fedora 23.
Following this page.
The problem is, the xmind binaries structure has changed since this article. So the commands needed are little bit different.
Download Xmind portable version from Xmind web page - http://www.xmind.net/xmind/downloads/xmind7-portable-3.6.0.R-201511090408.zip
Extract it to directory ~/xmind_portable, then cd ~/xmind_portable
Untar the data.tar.gz tar -xf data.tar.gz
Move desktop launcher sudo mv ./usr/share/applications/xmind.desktop /usr/share/applications
sudo mv ./usr/share/mime/packages/xmind.xml /usr/share/mime/packages/
Move application data sudo mv ./usr/lib/xmind/ /opt/
Update mime DB sudo update-mime-database /usr/share/mime/
Make a link to your bin
sudo ln -s /opt/xmind/XMind /usr/local/bin/xmind
Then use it!
xmind

How do I update phpMyAdmin in Ubuntu?

I have an old phpMyAdmin installation (contains my training and jobs data). I want to update it to the latest version and I want to keep my data safe while updating it. Is there any way to do it by running some commands on the terminal? Is my data erased if I uninstall phpMyAdmin?
Here is how to upgrade/downgrade on Ubuntu.
Note: The following instruction only works if you previously (and correctly) installed phpMyAdmin with the command line and use APACHE as a web server.
I suppose that you already have a working phpMyAdmin, but the version isn't the one you want. For instance, Ubuntu is shipping the 4.6.x version which doesn't work properly with PHP 7.2.
Check the version you want on:
https://www.phpmyadmin.net/files/
On your server
cd /usr/share/
rm -rf phpmyadmin
then adapt this line with the correct version number
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0/phpMyAdmin-4.8.0-all-languages.zip
unzip phpMyAdmin-4.8.0-all-languages.zip
rm phpMyAdmin-4.8.0-all-languages.zip
mv phpMyAdmin-4.8.0-all-languages phpmyadmin
Note: If unzip don't work, install it with: sudo apt-get install unzip
Check permissions
Now you should be good.
The owner of /usr/share/phpmyadmin should be root:root on a default installation. This should be fine but if you face some permissions issues, you can try to let Apache be the owner:
# only if you have permissions issues
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
You can also restart Apache
sudo service apache2 reload
Troubleshooting
Note: Depending on your PHP version, you may need to install additional libraries.
For example, to resolve the error about missing mysqli and mysql extensions (update the command to reflect your PHP version):
sudo apt-get install php5.6-mysql
phpmyadmin is mysql client, so it will not affect your database if you uninstall phpmyadmin.
I update phpmyadmin by using terminal commands:
First you have to add repository to get phpmyadmin :
sudo add-apt-repository ppa:nijel/phpmyadmin;
and then update it to get the latest version of software in repositories :
sudo apt-get update;
after that, you can get it (install, you need to uninstall the older version first if you have) :
sudo apt-get install phpmyadmin;
Oh, make sure you are connected to the internet
Using ubuntu? i think it will be better if you ask it in ubuntu forum.
may it helps
------ UPDATE -------
If you find the phpmyadmin version you get from ppa is not the latest one, you can find the latest version here and install it manually (not from repo).
Downloaded phpmyadmin can be installed in /var/www/html/ or in your working directory (public_html or something you've defined). Just extract the zip and move extracted folder to /var/www/html/. And don't forget to change the permission of the phpmyadmin folder to 777(it may not safe, but works fine).
Here is the how:
extract downloaded file
unzip phpMyAdmin-4.6.6-all-languages.zip
move to /var/www/html/, you might need sudo.
if you're not sudoer, move it into your working directory (e.g. public_html), and rename the folder to 'phpmyadmin'
sudo mv phpMyAdmin-4.6.6-all-languages /var/www/html/phpmyadmin
change the permission
sudo chmod 777 -R /var/www/html/phpmyadmin
and then you can access phpmyadmin via http://localhost/phpmyadmin.
If you put the phpmyadmin in public_html, you might want to create a symlink into it from /var/www/html, so you can access phpmyadmin as usual.
phpMyAdmin is only client for MySQL database, it doesn't contain your data. It's all saved in database, so nothing will be deleted even if you delete phpMyAdmin.
To update phpMyAdmin from repository you can follow steps from this thread.
1- check your phpmyadmin version from GUI.
2- Download Latest version of phpMyAdmin HERE
Use the below command to download the latest version of phpMyAdmin into /opt or /usr/src directory
# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.zip
Notes to install unzip package: apt-get install unzip
# unzip phpMyAdmin-4.8.3-all-languages.zip
3- Find phpMyAdmin Installation Directory
Use the below command to search the phpMyAdmin Installation Directory on your system
# /usr/share/phpMyAdmin
4- Remove/Delete phpMyAdmin content
/usr/share/phpmyadmin is correct phpMyAdmin installation directory, Just Delete/Remove everything from that directory
# cd /usr/share/phpMyAdmin/
# rm -Rf *
5- Move/Copy New phpMyAdmin content
Use the below command to copy all the new phpMyAdmin content to /usr/share/phpmyadmin.
# cd /opt/phpMyAdmin-4.8.3-all-languages
# mv * /usr/share/phpMyAdmin/
6- Restart Apache, MySQL or MariaDB service.
Start/Restart the service in SysVinit Systeme
# service restart httpd
# service restart mysql
Start/Restart the service in Systemd Systeme
# systemctl restart httpd.service
# systemctl restart mariadb.service
7- Now Check New version of phpMyAdmin
Navigate your browser to http://localhost/phpmyadmin, Now you are using latest version 4.8.3 of phpMyAdmin.
Reference
sudo su
cd /usr/share/
rm -rf phpmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.8.4/phpMyAdmin-4.8.4-all-languages.zip
unzip phpMyAdmin-4.8.4-all-languages.zip
mv phpMyAdmin-4.8.4-all-languages phpmyadmin
chown -R www-data:www-data /usr/share/phpmyadmin
chmod -R 755 /usr/share/phpmyadmin
sudo service apache2 reload