-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvagrant_notes.txt
246 lines (185 loc) · 8.3 KB
/
vagrant_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
* Vagrant Notes
Vagrant is a very powerful tool because of the two concepts it can manage for us:
**** Virtualization
**** Provisioning
Provisioning is the process of setting up a virtual machine so
that it can be used for a specific purpose or project. Typically, this involves installing
software, configuring the software, managing services running on the machine, and
even setting up users and groups on the machine
** Installation
1. download vagrant
2. download virtualbox
3. select appropriate image, ubuntu, linux etc.
4. vagrant init -> creates a initial configuration file, update the
file as required.
5. vagrant up -> starts the virtual server
6. other commands -> vagrant reload, vagrant suspend, vagrant destroy etc
7. enable virtualization on the machine from the bios setting, vt-x
8. to enable xwin server and desktop install lxde, other options
being ubuntu unity, gnome, xdfce, kde and etc. lxde is light weight.
9. some of the commands needed are:
sudo apt-get install lxde
sudo aptitude update
sudo aptitude install xorg lxde
sudo mkdir /usr/share/backgrounds
***** check if you need to do following:
In order to install the virtualbox-guest-additions in a way that causes no hiccups, we will do it via the temrinal window.
First, make sure you have the DKMS (Dynamic Kernel Module Support) package.
In a terminal window type:
Code:
sudo apt-get install dkms
Then, install the virtualbox-guest-additions by typing the following apt command in the terminal window:
Code:
sudo apt-get install virtualbox-guest-additions
***** check if you need this:
$ vagrant plugin install vagrant-vbguest
https://github.com/dotless-de/vagrant-vbguest
***** install linux vbox additions to get correct screen resolution
cd /media; cd /VBOX*; install linux additions as sudo
** Basic Commands
1. vagrant box --help
Available subcommands:
add
list
remove
repackage
2. vagrant resume, vagrant halt, vagrant destroy, vagrant up, vagrant provision
** Provisioning
1. Shell script
2. Puppet
3. Chef
** Shell Script
config.vm.provision :shell, :inline => "apt-get update"
** Chef
** Puppet
Puppet can be used to install software, manage cron jobs, manage
users and groups, run commands. We have modules, classes and stages
in puppet.
Resource types available include:
• cron: To manage cronjobs on Linux and UNIX basedsystems
• exec: To runcommands at the terminal/commandprompt
• file: To manage andmanipulate files and folders on the filesystem
• group: To manageuser groups
• package: To install software
• service: To manage running services on themachine
• user: To manage useraccounts on the machine
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "provision/manifests"
puppet.manifest_file = "default.pp"
puppet.module_path = "provision/modules"
end
To use 'test' command on linux: test -L /usr/local/bin/tmux | echo "$?"
*** Git Clone Puppet modules
1. git clone https://github.com/puppetlabs/puppetlabs-apt.git apt
2. git clone https://github.com/vagrantee/puppet-git.git git
3. git clone https://github.com/puppetlabs/puppetlabs-stdlib.git stdlib
4. git clone https://github.com/puppetlabs/puppetlabs-ruby.git ruby
** Ubuntu Notes
1. PPA , personal package archive. It is a collection of software
not included in Ubuntu by default.
sudo add-apt-repository ppa:repo-name
sudo apt-get update
sudo apt-get install <name>
sudo apt-get remove <name>
To upgrade all the currently installed software packages on the
system, currently installed packages are not removed or packages
which are not already installed neithere retrieved and installed
to satisfy upgrade dependencies.
sudo apt-get upgrade
If unconcerned of whether software packages will be added or
removed to fulfill dependencies:
sudo apt-get dist-upgrade
To remove software packages including their configuration files,
use 'purge' sub command
sudo apt-get purge <name>
Clean up disk space : sudo apt-get clean
Download without installing
sudo apt-get download <name>
Check for dependencies , borken:
sudo apt-get check
To free up significant volume of disk space
sudo apt-get autoclean
2. apt-cache
The apt-cache command line tool is used for searching apt software
package cache.It is used to search software packages, collects
information of packages and also used to search for what available
packages are ready for installation on Debian or Ubuntu.
apt-cache pkgnames
apt-cache search <name>
apt-cache show <name>
apt-cache stats
3. set time on linux
. more /etc/timezone
. sudo dpkg-reconfigure tzdata
. sudo service ntp stop
. sudo ntpdate pool.ntp.org
. sudo service ntp start
4. for tmux installation, git clone source and configure. soure-file
~/path to .tmux.conf to start using local tmux.conf
5. for ssh into guest machine from the host
Execute the following command:
vagrant ssh-config | grep IdentityFile | awk '{print $2}'
Then you should get something like:
/<somepath>/<username>/.vagrant.d/insecure_private_key
Now you can ssh into the VM by:
ssh 127.0.0.1 -p 2222 -i /<somepath>/<username>/.vagrant.d/insecure_private_key -l vagrant
6. Displaying remote clients
Displaying remote X clients with Cygwin/X is identical to displaying remote X clients with any other X Server.
It is recommended that you use the secure method of tunnelling the X connection over ssh.
Alternatively, you can use the host-based access control provided by
the X server,
connecting to the remote machine using telnet or rsh and directing
clients to connect to the server by setting the DISPLAY environment
variable.
Secure ssh
On your Windows machine:
Make sure you have the openssh package installed.
Launch Cygwin/X
Ensure the DISPLAY environment variable is set correctly.
(This step is not neccessary if you are entering your commands into an X terminal, as DISPLAY must already be set in that case)
$ export DISPLAY=:0.0
Run the ssh command to connect to the remote host:
$ ssh -Y username@remote_hostname_or_ip_address
Enter your password when prompted by ssh.
Your ssh session should now show you a shell prompt for your remote machine.
Note: The ssh server will automatically set the DISPLAY environment
variable appropriately,
typically to something like localhost:10.0, so clients will connect
to a proxy X11 display on the remote host from which the X11 protocol will be forwarded over ssh to your X server.
If your login scripts unconditionally set DISPLAY to something else, this will break X11 forwarding.
You can now launch remote X clients in your ssh session, for example:
$ xterm &
will launch an xterm running on your remote host that will display on your Cygwin/X screen.
Launch other remote clients in the same manner. I recommend starting
the remote clients in the background,
by appending & to the command name, so that you don't have to open several ssh sessions.
Note: By default, the OpenSSH server does not allow forwarded X
connections.
This must be configured on the remote host by adding X11Forwarding
yes to the sshd_config configuration file.
The OpenSSH server must be restarted or SIGHUP'ed to re-read the configuration file after it is changed.
Note: The OpenSSH server requires the xauth command to be available to
forward X connections. Consequently, it must be installed on the
remote host.
-> export DISPLAY=:0.0
-> ssh -Y [email protected] -p 2222
7. to turn off bell -> xterm -vb &
8. x-11 installation
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xserver-xorg-core
sudo apt-get install xserver-xorg
sudo apt-get install xorg
sudo apt-get install xorg openbox
sudo apt-get install ubuntu-desktop
https://help.ubuntu.com/community/ServerGUI
apt-get install dbus-x11
Sudo apt-get install xserver-xorg
Sudo apt-get remove --purge xserver-xorg
Sudo dpkg-reconfigure xserver-xorg
9. copy dot-files
ln -s /vagrant/dot-files/.tmux.conf .tmux.conf
ln -s /vagrant/dot-files/init.el .emacs.d/init.el
ln -s /vagrant/dot-files/.bash_profile .bash_profile
**
**