I install odoo on a virtualbox using vagrant (ubuntu/trusty32)
I set up odoo using the following:
vagrant init ubuntu/trusty32
in Vagrantfile
config.vm.network "private_network", ip: "55.55.55.7"
vagrant reload
vagrant ssh
sudo su
wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/9.0/nightly/deb/ ./" >> /etc/apt/sources.list
apt-get update && apt-get install odoo
sudo -u postgres createuser -s odoo
found the addons directory using:
# cd /etc/odoo/
# cat openerp-server.conf
[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/dist-packages/openerp/addons
created a theme in /usr/lib/python2.7/dist-packages/openerp/addons using https://www.odoo.com/documentation/9.0/howtos/themes.html
where is says:
Installing your theme
To install your theme, you just place your theme folder inside addons in your Odoo installation.
After that, navigate to the Settings page, look for your theme and click on the install button.
But the theme doesn't display in settings (http://55.55.55.7:8069/web#menu_id=86&action=78) or in the app list.
activate developer mode: https://www.odoo.com/forum/how-to/developers-13/how-can-i-activate-the-developer-mode-83
update the modules list: apps > Update Apps List
Now you can see the theme when you search in the App list
Related
Cross-Posted
Environmental Details
Relevant bits of server's /etc/ssh/sshd_config:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no
Relevant bits of client's $HOME/.ssh/config:
Host *
XAuthLocation /opt/X11/bin/xauth
ForwardX11 yes
ForwardX11Trusted yes
Using XQuartz on macOS High Sierra.
The Problem
I'm spinning up a vagrant Ubuntu 18.04 VM. I've added a second user outside of the vagrant user.
ssh -X vagrant#ubuntu-bionic xclock
I can get X11Forwarding to work when I login as the vagrant user. I cannot get X11Forwarding to work when I login as the ops user.
ssh -X ops#ubuntu-bionic xclock
X11 forwarding request failed on channel 0
Error: Can't open display:
I want to be able to get it to work with the ops user. From the client, $DISPLAY has a value. When I login with vagrant, $DISPLAY has a value. When I login as ops, $DISPLAY is unset. If I set $DISPLAY to match what it is with the vagrant user, I get the same error:
Error: Can't open display: localhost:10.0
when X11UseLocalhost yes
Error: Can't open display: ubuntu-bionic:10.0
when X11UseLocalhost no
If I login as ops and then sudo su - vagrant, $DISPLAY remains unset. If I login as vagrant and then sudo su - ops, $DISPLAY is inherited.
What am I missing to get this to work? I've run xhost + in each user (including sudo -s root xhost +) and it still doesn't work.
If I add -vv to my ssh commands, I see this message when connecting as vagrant:
X11 forwarding request accepted on channel 0
and as ops:
Remote: X11 forwarding disabled in user configuration file.
X11 forwarding request failed on channel 0
I don't get the whole topic, but for my very similar situation it helped to create the users~/.Xauthorityfile. I copied it from the vagrant users home directory and then set the new ownership.
On macOS BigSur with XQuartz 2.8.1 (xorg-server 1.20.11):
Setting the following into my Vagrantfile solved it for me (for ubuntu 20.04):
config.vm.provision "shell",
inline: "apt-get update && apt-get upgrade -y && apt-get install xauth -y"
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
The whole Vagrantfile would be:
Vagrant.require_version ">= 2.2.3"
Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |v, override|
override.vm.box = "bento/ubuntu-20.04"
end
config.vm.provision "shell",
inline: "apt-get update && apt-get upgrade -y && apt-get install xauth firefox firefox-geckodriver -y"
config.ssh.forward_agent = true
config.ssh.forward_x11 = true
end
Allows running firefox -no-remote https://stackoverflow.com/ through the X server.
The -no-remote flag is added since it seems to reduce the latency.
As inspired by a guide on How to enable and use SSH X11 Forwarding on Vagrant Instances by Josphat Mutai.
I followed million tutorials and guides on how to do it but no luck... Something is missing, hope you guys can help me out.
My OS: macOS Sierra
Virtualbox OS: Ubuntu 16.04
VM Network Adapter: Bridged Adapter
These are my steps:
Connect to vm via ssh
Install samba
$ sudo apt install samba
Create a directory to be shared
$ sudo mkdir /media/testshare
Add new share to smb.conf
$ sudo vim /etc/samba/smb.conf
[testshare]
comment = My Shared Folder
path = /media/testshare
browseable = yes
readonly = no
guest ok = yes
Restart samba
Add a samba password
$ sudo smbpasswd -a {username}
Try to connect from mac: In Finder, Command+K to open "Connect to Server" and in Server Address: smb://192.168.0.104
I'm getting this:
I tried smb://192.168.0.104/testshare, smb://192.168.0.104/media/testshare
I have no idea how to make it work. Help!
EDIT:
Might help, this is what I get when I run
$ sudo netstat -tulpn | egrep "samba|smbd|nmbd|winbind":
* I know that the ip is different now (192.168.0.104 => 192.168.0.109), its a new vm, don't pay attention to that.
Host OS: macOS El Capitan
VM (guest) OS: Ubuntu Server 16.04.5 LTS
VirtualBox v5.2.18
Both host OS and guest OS must have same user (further in the text: username).
Stage 1: Install VirtualBox Guest Additions:
1.1. Locate the VirtualBox Guest Additions,
$ cd /Applications/VirtualBox.app/Contents/MacOS/
$ cp VBoxGuestAdditions.iso ~/Downloads/
1.2. Start the VM
1.3. Click the CD icon in the bottom right task bar
1.4. Select "Choose disk image..."" and search for the VBoxGuestAdditions.iso
1.5. In the guest terminal type (you can also do this from the host terminal if you SSH into it):
$ sudo su
$ apt update
$ apt upgrade
$ apt-get install dkms build-essential linux-headers-generic gcc make
$ mount /dev/cdrom /mnt
$ cd /mnt
$ sh ./VBoxLinuxAdditions.run
$ reboot
Stage 2: Shared Folders Setup:
2.1. Create rules in VM:
Stop the VM
Go to Settings > Shared Folders
Click in the Add new port forwarding rule green button in the top right of the window.
Search and select the folder you would like to share (e.g.: /path/to/shared/host_folder)
Select the Auto-mount and Make Permanent options
Start the VM
2.2. To mount shared folder on /opt you must create shared_folder_dir subfolder and set appropriate permissions to it:
$ sudo mkdir -p /opt/shared_folder_dir
$ sudo chmod ug+w -Rv /opt/shared_folder_dir
$ sudo chown username:username -Rv /opt/shared_folder_dir
2.3. Add username to the vboxsf group:
$ sudo adduser username vboxsf
$ sudo usermod -a -G vboxsf username
2.4. Reboot VM to apply changes:
$ sudo reboot
Stage 3: Auto mounting host_folder into /opt/shared_folder_dir:
3.1. Change VM's /etc/rc.local:
$ sudo nano /etc/rc.local
and place following right above exit 0:
# 'folder_name' = given in the shared folders configuration
# 'path/to/shared/folders' = guest path to access the shared folders from
# 'id' = prints uid/gid
# sudo mount -t vboxsf -o uid={uid},gid={gid} {shared_folder_name} {path/to/shared/folder}
sleep 5
sudo mount -t vboxsf -o uid=1000,gid=1000 host_folder /opt/shared_folder_dir
exit 0
<<< EOF >>>
Note:
I've added sleep 5 to execute mount operation after VirtualBox Guest Additions has started. You can check that by journalctl -b command.
3.2. Reboot VM to apply changes:
$ sudo reboot
See also
We've got a multi-machine Vagrantfile in our project repo which sets up a LAMP stack and creates some common MySQL databases. Now, each of us also have a personal database that we'd like Vagrant to create as part of the initial "vagrant up" provisioning. I've placed my personal provisioning code in ~/.vagrant.d/Vagrantfile, but according to the load order of Vagrantfiles, that code runs before the provisioning code of the common Vagrantfile. My personal provisioning code is unable to add any MySQL database because MySQL simply hasn't been installed yet, as that is the responsibility of the common Vagrantfile.
How can I have it so that the common Vagrantfile installs MySQL and the personal Vagrantfile adds a database once MySQL is in place?
Update
Here is what I ended up doing.
Vagrantfile (shared with other developers):
Vagrant.configure("2") do |config|
config.vm.define "dev14" do |dev14|
dev14.vm.box = "ubuntu/trusty64"
dev14.vm.provision "file", source: "common.sql", destination: "common.sql"
dev14.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y apache2
sudo apt-get install -y php5
sudo apt-get install -y mysql-server
sudo apt-get install -y mysql-client
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS common"
mysql -uroot -proot common < common.sql
SHELL
# User specific provisioning
$dev14 = dev14
load './provision.dev14.rb' if File.exists?('./provision.dev14.rb')
end
end
provision.dev14.rb (my personal provisioning file, Git ignored):
$dev14.vm.provision "file", source: "personal.sql", destination: "personal.sql"
$dev14.vm.provision "shell", inline: <<-SHELL
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS personal"
mysql -uroot -proot personal < personal.sql
SHELL
These are of course sanitised and simplified excerpts.
We found the easiest solution for this was to specify multiple provision scripts and have your 'create the database' Vagrant file script detect whether or not it needs to do anything.
Also, can you parameterise the personalization stage e.g. base database creation on ENV['DB_USERNAME'] etc.? This would allow you to benefit from trying each other's setup.
Beyond this, you can write a plugin to have finer control over which Vagrant action is running and hook in to pre/post action events.
Introduction
I'm using Vagrant and want to create a box that fits my needs. I'm currently building my provisioning script but I have a problem which would require me to relog into the box.
What I'm trying to achieve
I want to set my locales to the German language
What I'm doing
After logging into my vagrant box with vagrant ssh I'm running the following commands
sudo apt-get update
sudo cp /var/www/projectfantasy/www/vagrant_ressources/locale.gen /etc/
sudo locale-gen de_DE.UTF-8
These steps are done with the help of Debian's wiki. The last step is
To use the new settings with your programs, log out and back in.
And now I am where I need help. How would I relog while being in the vagrant provisioning script? When I don't relog I'm getting the following warnings when installing extra packages.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "de_DE.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
I mean, these are only warnings so that shouldn't be a problem, right? But I don't want to have warnings and would like to know how I could fix this issue.
When I relog and try to install those packages again it works without any problems.
unfortunately, this is not so simple - if you issue a reboot command or shutdown -r now in your provisioning script the VM will restart (indeed) but then the provisioning will not continue.
fortunately, some people wrote plugin (https://github.com/exratione/vagrant-provision-reboot and https://github.com/aidanns/vagrant-reload) I experienced with the second and it works
make sure to install the plugin
$ vagrant plugin install vagrant-reload
in your vagrantfile, your provisioning will look like
config.vm.provision "shell", path: "vagrant_ressources/preparations.sh"
config.vm.provision :reload
config.vm.provision "shell", path: "vagrant_ressources/bootstrap.sh"
so preparations.sh will execute, then the VM will reload and bootstrap.sh will execute
in your preparations.sh, after you generate locale, make sure variables are set in the locale file :
sudo locale-gen
echo -e 'LANG=de_DE.UTF-8\nLC_ALL=de_DE.UTF-8' > /etc/default/locale
sudo timedatectl set-timezone Europe/Berlin
PS : one note on your usage of the shell provisioning. By default provisioning is run with root privilege so there is no need for all the sudo ; if you want to run the provisioning as vagrant user run it as config.vm.provision :shell, privileged: false ... and you will need the sudo
I couldn't reproduce your warning, but I find this will allow you to set LC_ALL:
sudo update-locale LC_ALL=de_DE.UTF-8
(from https://askubuntu.com/questions/114759/warning-setlocale-lc-all-cannot-change-locale, but works for debian jessie as well)
The issue: When I try to install a package ansible does not proceed. The CLI just sits there idle.
SSH is cofigured to connect with out prompting for a password. I have created a user called "test" and my sudoers file has the following configuration:
test ALL=(ALL) NOPASSWD:ALL
Also in /etc/ansible/ansible.cfg
inventory = /etc/ansible/hosts
#library = /usr/share/my_modules/
remote_tmp = $HOME/.ansible/tmp
pattern = *
forks = 5
poll_interval = 15
sudo_user = root
#ask_sudo_pass = True
#ask_pass = True
transport = smart
#remote_port = 22 module_lang = C
When as user "test" I do
yum install lynx
the package specified gets installed.
But if I do
ansible local -s -m shell -a 'yum install lynx'
Nothing happens.
I am not sure what is going on :(
Try using the yum module instead:
ansible local -s -m yum -a 'name=lynx state=present'
You have to say "yes" to yum:
Try this instead:
ansible local -s -m shell -a 'yum install lynx -y'
You should be using either the yum module or even better, the package module which is OS generic.
On the other hand, you other option is the raw module which runs an SSH-dirty command against your nodes!
This is an example for using the package module in a task:
----
- hosts: <hosts_names>
sudo: yes
tasks:
- name: install lynx
register: result
package: name=lynx state=latest
become: yes
become_user: root
become_method: sudo
ignore_errors: True
Using the above playbook, hopefully helps you to install you desired package and even if it did not do that, you'll be able to easy go through the result variable and see what's going wrong.
And of course before all these, you should've made sure that your YUM repository/ies work propeprly!