ubuntu 12.04 into docker "service mysql start" - mysql

I need ubuntu 12.04 with developing web-services running (sshd, apache2.2, php5.3, mysql-server). I have ubuntu 14.04, i installed docker.
Then i started container:
docker run -t -i ubuntu:12.04 /bin/bash
Then:
apt-get update && apt-get install -y mysql-server
After that: service mysql start, service mysql status is not working. If i am running container with 14.04 ubuntu, it works well. The same issue is with sshd server.
service apache2 status, service apache2 stop, service apache2 start works well.

There is no init process running inside the container. Therefore the runelevel can't be determined.
If there is an unknown runlevel, upstart can not start mysql. ... see /etc/init/mysql.conf
...
start on runlevel [2345]
...
If you try to check the runlevel:
$ runlevel
unknown
... you see it is unknown.
In Docker it is the common way to start the application in foreground.
/usr/bin/mysqld_safe
If you want to start more than one application, you can use supervisord.
http://supervisord.org/
https://docs.docker.com/articles/using_supervisord/
Additional i've found a Dockerfile, which starts a init inside a ubuntu:12.04 docker container. Really nice work:
https://github.com/tianon/dockerfiles/blob/master/sbin-init/ubuntu/upstart/12.04/Dockerfile

Related

How to install 'systemctl' on Ubuntu (docker)?

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it.
Installation went fine (apt-get install -y mysql-server) and now is time to run a server:
systemctl status mysql
Failed to connect to bus: No such file or directory
How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?
Systemd is not installed on the ubuntu docker image. You can use the "service" command
service mysql start
service mysql status
You can also use the mysql docker image instead of installing mysql manually on ubuntu.
Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

Maria DB (mysql) installation on Red Hat . How do I start service after installation

I have installed mysql (maria db) on redhat.
My question is - how do I start and stop the server?
STEPS
I ran the command
$sudo yum install mysql
It gave long messages in the console while installing and and at the end said
Installed:
mariadb.x86_64 1:5.5.41-2.el7_0
Dependency Installed:
perl.x86_64 4:5.16.3-285.el7 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-2.el7
perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-285.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-3.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-285.el7 perl-macros.x86_64 4:5.16.3-285.el7 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7
But now when I run the command
$ sudo service mysql start
it gives messages
Redirecting to /bin/systemctl start mysql.service Failed to issue
method call: Unit mysql.service failed to load: No such file or
directory.
I am using Red hat version - Red Hat Enterprise Linux Server release 7.1 (Maipo)
I believe you've installed only the client. For the server do yum install mariadb-server. The package will install appropriate service file for you.
The name of the service though is mariadb. Well that is the case on CentOS 7 at least... So, after you install mariadb-server package do systemctl enable mariadb and systemctl start mariadb.
The service is called mysqld, not mysql. So:
$ service mysqld start
Or better yet, use the proper systemd syntax:
$ systemctl start mysqld

start apache & mysql from desktop script in ubuntu

on lubuntu 14.04 (desktop) i have installed apache web server and mysql server and, because of low ram (only 1024mb), i decided to remove them from startup (with sudo update-rc.d -f apache2 remove and by editing the /etc/mysql/my.cnf file ).
now, every time i want to do some development i have to sudo service apache2 start and sudo service mysql start in a terminal. wich is fine.
my question is: could those commands be executed from a .sh file? a file that i can double-click it from my desktop?
so far i got
#!/bin/sh
sudo service apache2 start
sudo service mysql start
You can do it with scripts which you mentioned.
Apache:
#!/bin/sh
sudo service apache2 start
Mysql
#!/bin/sh
sudo service mysql start

Connection time out installing mysql server in unix

I am trying to install mysql server in my AWS EC2 instance. I googled and executed the below command in the shell.
sudo yum install mysql-server
It throws the below connection timed out exception
Loaded plugins: priorities, update-motd, upgrade-helper
http://packages.us-west- 2.amazonaws.com/2014.03/main/201403504e47/x86_64/repodata/repomd.xml?instance_id=i-c82c93c3&region=us-west-2: [Errno 12] Timeout on http://packages.us-west-2.amazonaws.com/2014.03/main/201403504e47/x86_64/repodata/repomd.xml?instance_id=i-c82c93c3&region=us-west-2: (28, 'Connection timed out after 10001 milliseconds')
Trying other mirror.
Is this the right way to install mysql server?
Thanks.
installing mysql
From the current AWS EC2 documentation:
To install and start the LAMP web server
Connect to your instance.
To ensure that all of your software packages are up to date, perform a quick software update on your instance. This process may take a few minutes, but it is important to make sure you have the latest security updates and bug fixes.
Note
The -y option installs the updates without asking for confirmation. If you would like to examine the updates before installing, you can omit this option.
[ec2-user ~]$ sudo yum update -y
Now that your instance is current, you can install the Apache web server, MySQL, and PHP software packages. Use the yum groupinstall command to install multiple software packages and all related dependencies at the same time.
[ec2-user ~]$ sudo yum groupinstall -y "Web Server" "MySQL Database" "PHP Support"
Note
Non-Amazon Linux instances may have subtle differences in their group names. If the above command fails because of an invalid group name, use the yum grouplist command and scan the output for similar groups, such as "MySQL Database server" instead of "MySQL Database", and use the appropriate group name for your distribution.
Install the php-mysql package.
[ec2-user ~]$ sudo yum install -y php-mysql
I suppose you only need to install mysql, so you just need to run the 1st command, adapt the second to only grab mysql from the repositories, and skip the last one:
[ec2-user ~]$ sudo yum update -y
[ec2-user ~]$ sudo yum groupinstall -y "MySQL Database"
Depending on which version of linux you have installed (Amazon, Red Hat or CentOS), you may need to change the string "MySQL Database" to something else. The following command:
[ec2-user ~]$ sudo yum grouplist
Will list all the possible group install you may perform, so you need to filter it to get the right string:
[ec2-user ~]$ sudo yum grouplist | grep -i mysql
And choose the most appropriate one in that filtered result set.
network connectivity
Now, regarding your specific issue, the FAQs describes your problem as follow:
If the AMI cannot access the yum repositories, it will timeout and retry multiple times before completing the boot procedure. Possible reasons for this are restrictive firewall settings or VPC settings, which prevent access to the Amazon Linux AMI package repositories.
If you encounter this issue you can either modify your environment so that the Amazon Linux AMI can connect to its package repositories [...]
Unfortunately, no explanations are given as yo how you can change your environment to enable connectivity.
Apparently, by using the dashboard, you should be able to open outbound access to the port the yum servers are using:
AWS dashboard > ec2 > security groups > default group > outbound rule: ??? (HTTP*) 0.0.0.0/???
The usual port for yum server is 80, so just replace ??? above by 80 to have access to the repos. You also should replace 0.0.0.0 with the actual repository server address.
If this solution does not work, you might also try disabling the firewall altogether for the duration of the update:
[ec2-user ~]$ sudo /etc/init.d/iptables stop
<...Update commands as listed above...>
[ec2-user ~]$ sudo /etc/init.d/iptables start
Or
[ec2-user ~]$ sudo /sbin/service iptables stop
<...>
[ec2-user ~]$ sudo /sbin/service iptables start
I just delete all the files in /etc/resolv.conf dir

MySQL server not running as service

I Have Installed mysql-server as root with command :
sudo apt-get install mysql-server
i have configured and changes too many things related to the mysql-server Now the problem is that Mysql is not working as service
as it is not in /etc/init.d
I want the mysql server to be started at boot time means to make it the service.
Now what i have to do please help.
I find chkconfig easy to use: sudo chkconfig --list|grep mysql but it might be an outdated mode of handling it. Most of my servers have long used it but I find my desktop Ubuntu didn't have it and complains if I use it.
If you don't have chkconfig, do sudo apt-get install chkconfig
To turn it on: chkconfig mysql on