I am trying to configure the networking options for my lxd container but when I try the following command:
lxc network create testbr0
I get the following result:
root#Server02:/var/lib# lxc network create testbr0
Usage: lxc [options]
Checking the list of available commands, I dont see network as an option
Here are the available commands I see:
config, copy, delete, exec, file, finger, image, info, init, launch, list, monitor, move, pause, profile, publish, remote, restart, restore, snapshot, start, stop, version
I'm using Ubuntu 14.04
Any insights?
Thanks
I assume you are using lxd Version 2.0.11. There is no network command in this version.
If you want to use the network command you have to install lxd feature releases (LXD 2.x).
On Ubuntu 14.04 there is no ppa containing the lxd feature releases, so you have to install snap and use the snap package:
sudo apt update
# check if snap is installed, install it if not
if ! type snapctl >/dev/null; then sudo apt install -y snapd; fi
# install lxd
sudo snap install lxd
# wait for lxd startup
while ! echo -e "GET / HTTP/1.0\r\n" | sudo nc -U /var/snap/lxd/common/lxd/unix.socket > /dev/null; do sleep 1; done
# migrate from ppa to snap lxd
sudo /snap/bin/lxd.migrate
# 14.04 does not add the user to lxd group so we do it explicitly
sudo adduser $(id -un) lxd
Related
I was creating an own docker image based on the latest rakudo-star docker image. I wanted to use DBIish to connect to a mysql database. Unfortunately I am not able to get the DBDish::mysql to work.
I've installed default-libmysqlclient-dev as you can see in
# find / -name 'libmysqlclient*.so'
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
The error i am facing is:
# perl6 -Ilib -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot locate native library 'mysqlclient': mysqlclient: cannot open shared object file: No such file or directory
in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289
in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 539
in method connect at /root/DBIish/lib/DBDish/mysql.pm6 (DBDish::mysql) line 12
in block <unit> at -e line 1
Short answer: you need the package libmysqlclient20 (I added the documentation request to a similar DBIish issue). Debian 9 (stable at the moment) uses and older version than Ubuntu 18.04 (stable at the moment) and Debian Unstable. It also refers to mariadb instead of mysql. Pick libmariadbclient18 on images based on Debian Stable and create a link with the mysql name (see below).
On Debian Testing/Unstable and recent derivatives:
$ sudo apt-get install libmysqlclient20
$ dpkg -L libmysqlclient20
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.9
/usr/share
/usr/share/doc
/usr/share/doc/libmysqlclient20
/usr/share/doc/libmysqlclient20/NEWS.Debian.gz
/usr/share/doc/libmysqlclient20/changelog.Debian.gz
/usr/share/doc/libmysqlclient20/copyright
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.20
On Debian 9 and derivatives:
$ dpkg -L libmariadbclient18
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/mariadb18
/usr/lib/x86_64-linux-gnu/mariadb18/plugin
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/client_ed25519.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/dialog.so
/usr/lib/x86_64-linux-gnu/mariadb18/plugin/mysql_clear_password.so
/usr/share
/usr/share/doc
/usr/share/doc/libmariadbclient18
/usr/share/doc/libmariadbclient18/changelog.Debian.gz
/usr/share/doc/libmariadbclient18/copyright
/usr/lib/x86_64-linux-gnu/libmariadbclient.so.18
Create the link:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
In order to illustrate this, I created an Ubuntu 18.04 container for the occasion*:
docker run -ti --rm --entrypoint=bash rakudo/ubuntu-amd64-18.04
And the abbreviated commands and output:
# apt-get install -y libmysqlclient20 build-essential
# zef install DBIish
# perl6 -e 'use DBDish::mysql; DBDish::mysql.connect()'
Cannot look up attributes in a DBDish::mysql type object
[...]
The error is because I didn't pass the correct parameters for connect as I didn't have a db running. The important thing is that no .so file is missing.
*: I uploaded it to the Docker Hub, a normal run will put you right in the REPL:
$ docker run -ti --rm rakudo/ubuntu-amd64-18.04
To exit type 'exit' or '^D'
>
(I didn't use the Star image when debugging, but it does not matter because this is a more generic problem.)
I have a simple startup script which looks like so:
#!/usr/bin/env bash
sudo apt update
sudo apt install -y ruby-full ruby-bundler build-essential
And create VM instance on GCP like so:
$ gcloud compute instances create test-app --boot-disk-size=10GB --image-family ubuntu-1604-lts --image-project=ubuntu-os-cloud --machine-type=g1-small --zone europe-west1-b --tags test-server --restart-on-failure --metadata-from-file startup-script=startup.sh
My startup.sh is executable. I set its rights like so:
$ chmod +x startup.sh
When however I enter the shell of my newly created instance and check bundler:
test-app:~$ bundle -v
I get these messages:
The program 'bundle' is currently not installed...
So, what is wrong with that and how can I fix it? PS. If I run all my commands just from inside the instance shell, it's all ok, so there is some problem with using startup script on GCP.
I tested with your use case, But the bundle package was installed without making any changes.
Output:
bundle -v
Bundler version 1.11.2
You can check VM serial console log output to verify if start-up script ran. Check the VM instance to verify if the package is installed using the commands below:
sudo apt list --installed | grep -i bundle
sudo egrep bundle /var/log/dpkg.log
In addition, check the gem list bundle
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®ion=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®ion=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
This error is being shown whenever I want to install any software via command line.
Even if i try to install softwares which I know are present at the source from where I am downloading.
Below is the full error message i am getting :
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mysql-server' has no installation candidate
It worked for me.
If you have followed all the previous steps successfully and after running sudo apt-get install mysql-server you are getting an error then try this
sudo apt-get install mariadb-server
I experienced this issue when trying to install MySQL Server on Debian 10.
Here's how I fixed it:
The issue is caused by the MySQL server apt repository not being included in your system's software repository list. In Debian 10 for example, MariaDB, a community fork of the MySQL project, is packaged as the default MySQL variant.
So to fix this first, add the MySQL server apt repository to your system's software repository list. Follow these steps:
Go to the download page for the MySQL APT repository at:
https://dev.mysql.com/downloads/repo/apt/
Select and download the release package for your Linux distribution. You can use:
sudo wget https://the-download-link
In my case it was:
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Install the downloaded release package with the following command, replacing version-specific-package-name with the name of the downloaded package (preceded by its path, if you are not running the command inside the folder where the package is):
sudo dpkg -i version-specific-package-name.deb
In my case it was:
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Note: dpkg is used to install, remove, and inspect .deb software packages. The -i flag indicates that we’d like to install from the specified file.
During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. The defaults will add the repository information for the latest stable version of MySQL and nothing else. This is what we want, so use the down arrow to navigate to the Ok menu option and hit ENTER.
You'll also be asked to select a repository to add. Choose 'debian buster' which has the package 'mysql-server' in it. After the adding this repository you can update the repository and use the below command to install MySQL.
sudo apt-get install mysql-server
The package will now finish adding the repository. Refresh your apt package cache to make the new software packages available:
sudo apt update
Note: If you ever need to update the configuration of these repositories, just run sudo dpkg-reconfigure mysql-apt-config, select new options, and then sudo apt-get update to refresh your package cache.
Install MySQL by the following command:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Note: This installs the package for the MySQL server, as well as the packages for the client and for the database common files. During the installation, you are asked to supply a password for the root user for your MySQL installation.
The MySQL server is started automatically after installation. You can check the status of the MySQLserver with the following command:
sudo service mysql status
Stop the MySQL server with the following command:
sudo service mysql stop
To restart the MySQL server, use the following command:
sudo service mysql start
MySQL creates a default user called root. You can change the password to any password of your choice by logging in to MySQL console using socket authentication:
sudo mysql -u root
Then run the command below to change the password
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'your-preferred-password';
Reference:
A Quick Guide to Using the MySQL APT Repository
How To Install the Latest MySQL on Debian 10
That's all.
I hope this helps
You can install mysql by
sudo apt install default-mysql-server
--------
sudo service mysql status
● mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 13:19:33 +08; 33s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 18537 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 4915)
Memory: 73.1M
CGroup: /system.slice/mariadb.service
└─18537 /usr/sbin/mysqld
run:
apt install default-mysql-server
which installs MariaDB unfortunately, but still responds to service mysql status
Most likely you are running on ubuntu. It is important to run apt-get update first.
I am trying to install MySQL 5.6 in amazon linux machine. by using following link.
after completing following steps.
sudo yum localinstall http://repo.mysql.com/mysql-community-release-el6-3.noarch.rpm
sudo yum install mysql-community-server
when i am starting mysql services by this command.
sudo service mysqld start
I am getting MySQL Daemon failed to start error.
Remove old mySql
sudo yum remove mysql mysql-server mysql-common mysql-client
remove all pre-installed packages. You can get a list:
rpm -qa | grep -i mysql
Then uninstall all of them. For example:
rpm -e mysql libmysqlclient15-5.0.94-0.2.4.1 <and so on>
Completely remove the /var/lib/mysql folder
cd /var/lib
rm -rf mysql
Installing fresh mySql 5.6 =>
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/MySQL-5.6.23-1.el7.x86_64.rpm-bundle.tar
tar -xvf MySQL-5.6.23-1.el7.x86_64.rpm-bundle.tar
sudo yum -y install MySQL-client-5.6.23-1.el7.x86_64.rpm
sudo yum install MySQL-shared-compat-5.6.23-1.el7.x86_64.rpm
sudo yum install MySQL-server-5.6.23-1.el7.x86_64.rpm
Starting from 2015 Sep, Mysql 5.6 server is now natively available through Amazon yum repos. More info # https://aws.amazon.com/blogs/aws/now-available-amazon-linux-ami-2015-09/
You can now simply install Mysql 5.6 server using
sudo yum install mysql56-server
Then you can simply start/stop/status look using the regular service commands
service mysqld start ( restart | stop | status | )
I couldn't figure out the default root password in Amazon AMI then I simply reset the root user password by starting the mysqld service with skip grant tables
mysqld_safe --skip-grant-tables start
mysql -u root
update user set password=PASSWORD('[New Password]') where User='root';
OR
/usr/libexec/mysql56/mysqladmin -u root password 'new password'
Also, you need to run the following command to upgrade the MySQL database to 5.6
sudo mysql_upgrade -u root -p
I met the same problem on my micro instance. Check your mysql logs
If the issue is because of
InnoDB: Cannot allocate memory for the buffer pool
Adding a swap page might solve the problem. It solved for me.
You can follow this setup
http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html
I copied the contents if the page does not loads
Amazon EC2 Micro Instance Swap Space - Linux
I have a Amazon EC2 Linux Micro instance. Since Micro instances have only 613MB of memory, MySQL crashed every now and then. After a long search about MySQL, Micro Instance and Memory Managment I found out there is no default SWAP space for Micro instance. So if you want to avoid the crash you may need to setup a swap space for your micro instance. Actually performance wise is better to enable swap.
Steps below show how to make a swap space for your Micro instance. I assume you have AWS Account with a Micro instance running.
Run dd if=/dev/zero of=/swapfile bs=1M count=1024
Run mkswap /swapfile
Run swapon /swapfile
Add this line /swapfile swap swap defaults 0 0 to /etc/fstab
Step 4 is needed if you would like to automatically enable swap file after each reboot.
Some useful command related to SWAP space:
$ swapon -s
$ free -k
$ swapoff -a
$ swapon -a