-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinuxsetup.html
387 lines (348 loc) · 12.7 KB
/
linuxsetup.html
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
<!DOCTYPE html>
<html lang="en">
<head>
<!-- 2019-03-01 五 19:12 -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Linux Setup</title>
<meta name="generator" content="Org mode">
<meta name="author" content="George Kontsevich">
<meta name="description" content="Notes from setting up things on Linux"
>
<link rel="stylesheet" type="text/css" href="./static/worg.css" />
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Linux Setup</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org46653e8">Intro</a></li>
<li><a href="#orgdd7eee1">Bash-completion</a></li>
<li><a href="#org9093180">Syncthing</a></li>
<li><a href="#orgdc2d22a">Fluxbox</a></li>
<li><a href="#org1b1ebb2">Other</a>
<ul>
<li><a href="#org7d7a5ce">fstab settings for autmounting device</a></li>
<li><a href="#orgd27afaa">giving permissions to sigrok</a></li>
</ul>
</li>
<li><a href="#org22ef1f3">Fonts</a></li>
<li><a href="#org3047baa">Emacs Daemon</a>
<ul>
<li><a href="#orgcb65801">The Daemon</a></li>
<li><a href="#orgfc30415">The Client</a></li>
</ul>
</li>
<li><a href="#org815a838">Firefox</a></li>
<li><a href="#orgdcb90c1">fcitx</a></li>
</ul>
</div>
</div>
<div id="outline-container-org46653e8" class="outline-2">
<h2 id="org46653e8">Intro</h2>
<div class="outline-text-2" id="text-org46653e8">
<p>
Private notes on setting up (or re-setting up) my Linux/Ubuntu/Debian system
</p>
</div>
</div>
<div id="outline-container-orgdd7eee1" class="outline-2">
<h2 id="orgdd7eee1">Bash-completion</h2>
<div class="outline-text-2" id="text-orgdd7eee1">
<p>
To autocomplete and make life easier
</p>
<div class="org-src-container">
<pre class="src src-sh">apt-get install bash-completion
</pre>
</div>
</div>
</div>
<div id="outline-container-org9093180" class="outline-2">
<h2 id="org9093180">Syncthing</h2>
<div class="outline-text-2" id="text-org9093180">
<p>
To sync my document and files
</p>
<div class="org-src-container">
<pre class="src src-sh">apt-get install syncthing
</pre>
</div>
<blockquote>
<p>
Note: You can't run syncthing as a daemon in a <code>chroot</code>. So like on a chromebook/crouton, you simply have to run it from the command line as <code>syncthing</code> and then control it throught <a href="https://localhost:8384/">the browser</a>
</p>
</blockquote>
<p>
Next we need to set up <code>syncthing</code> to autostart on the system and run in the background as a daemon. Daemons are managed by <code>systemd</code>. For a description see: <a href="http://n0where.net/understanding-systemd">http://n0where.net/understanding-systemd</a>
</p>
<p>
We will run syncthing as a system-service so it runs even when you're logged out. It can also be configured to run as a user-service that runs only when a user is logged in. This is described in the <a href="https://docs.syncthing.net/users/autostart.html#linux">documentation</a>. To create the system service, run:
</p>
<div class="org-src-container">
<pre class="src src-sh">systemctl enable [email protected]
</pre>
</div>
<p>
<code>geokon</code> is my user name (replace is appropriate). Why does the <i>system</i> service require a username? <a href="https://www.linuxbabe.com/backup/install-syncthing-debian-8-server-back-up-website">Because</a> "The Syncthing system service must be started for a user with a home directory because Syncthing needs to store configuration files under the user’s home directory."
</p>
<p>
This creates some symlink from the <code>systemd</code> config files to some other stored file (for <code>syncthing</code>) that Debian has added to <code>systemd</code> for us. (these paths don't make sense to me… but okay)
</p>
<div class="org-src-container">
<pre class="src src-sh">/etc/systemd/system/multi-user.target.wants/[email protected] -> /lib/systemd/system/[email protected]
</pre>
</div>
<p>
Next we launch the service we've added
</p>
<div class="org-src-container">
<pre class="src src-sh">systemctl start [email protected]
</pre>
</div>
<p>
To check it's status there is the following <code>systemd</code> command
</p>
<div class="org-src-container">
<pre class="src src-sh">systemctl status [email protected]
</pre>
</div>
<p>
But it's a bit last-resort. It's easier to check through the <a href="https://localhost:8384/">control panel</a><br>
<a href="https://localhost:8384/">https://localhost:8384/</a>
</p>
</div>
</div>
<div id="outline-container-orgdc2d22a" class="outline-2">
<h2 id="orgdc2d22a">Fluxbox</h2>
<div class="outline-text-2" id="text-orgdc2d22a">
<div class="org-src-container">
<pre class="src src-sh">apt-get install fluxbox
apt-get install xorg
apt-get install xserver-org
</pre>
</div>
<p>
First install is about 20MB<br>
Second is around 200MB
to launch the X11 server and run <code>fluxbox</code>
</p>
<div class="org-src-container">
<pre class="src src-sh">startfluxbox
</pre>
</div>
</div>
</div>
<div id="outline-container-org1b1ebb2" class="outline-2">
<h2 id="org1b1ebb2">Other</h2>
<div class="outline-text-2" id="text-org1b1ebb2">
</div>
<div id="outline-container-org7d7a5ce" class="outline-3">
<h3 id="org7d7a5ce">fstab settings for autmounting device</h3>
<div class="outline-text-3" id="text-org7d7a5ce">
<pre class="example">
/dev/disk/by-id/usb-SanDisk_Cruzer_Blade_4C531001550107103073-0:0-part1 /home/geokon/USB auto nosuid,nodev,nofail,x-gvfs-show,auto,exec,uid=geokon,gid=geokon,x-systemd.automount 0 0
</pre>
<p>
this goes into <code>/etc/fstab/</code> on a separate line on its own
</p>
<p>
In another version it looked like this for me
</p>
<pre class="example">
/dev/disk/by-id/usb-Samsung_Flash_Drive_0376618030015678-0:0-part1 /home/geokon/USB auto nosuid,nodev,nofail,x-gvfs-show,auto,exec,uid=geokon,gid=geokon,x-systemd.automount\0400\0400 0 0
</pre>
</div>
</div>
<div id="outline-container-orgd27afaa" class="outline-3">
<h3 id="orgd27afaa">giving permissions to sigrok</h3>
<div class="outline-text-3" id="text-orgd27afaa">
<p>
Need to be done by adding permissions files into <code>/usr/lib/udev/rules.d/</code>
<a href="https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=README.devices">https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=README.devices</a>
<a href="https://raw.githubusercontent.com/sigrokproject/libsigrok/master/contrib/60-libsigrok.rules">https://raw.githubusercontent.com/sigrokproject/libsigrok/master/contrib/60-libsigrok.rules</a>
<a href="https://raw.githubusercontent.com/sigrokproject/libsigrok/master/contrib/61-libsigrok-uaccess.rules">https://raw.githubusercontent.com/sigrokproject/libsigrok/master/contrib/61-libsigrok-uaccess.rules</a>
</p>
</div>
</div>
</div>
<div id="outline-container-org22ef1f3" class="outline-2">
<h2 id="org22ef1f3">Fonts</h2>
<div class="outline-text-2" id="text-org22ef1f3">
<p>
This is super confusing.. so this is just a list of notes
</p>
<p>
Ubuntu blocks bitmap fonts by default for some reason - so you need to delete some special file to reenable them. Details are here: <a href="https://wiki.ubuntu.com/Fonts#Enabling_Bitmapped_Fonts">https://wiki.ubuntu.com/Fonts#Enabling_Bitmapped_Fonts</a>
</p>
<p>
If a bitmap font comes in a TrueType format, don't use that! It will come out looking weird and will scale in strange ways
</p>
<p>
The tewi font has instructions on how to install things; <a href="https://github.com/lucy/tewi-font#installation">https://github.com/lucy/tewi-font#installation</a> You need to download the BDF file, then convert it to a PCF file, put them into a directory and use <code>xset +fp /path/to/fontdir/</code> to then add that directory to the list of font directories. Then run <code>fc-cache -fv</code> to rescan all the fonts on the system. After that it should show up in the font menues
</p>
<p>
The .Xresources file will have two lines to setup Emacs and Xterm:
</p>
<pre class="example">
Emacs.font: Zpix
XTerm*faceName: Zpix
</pre>
</div>
</div>
<div id="outline-container-org3047baa" class="outline-2">
<h2 id="org3047baa">Emacs Daemon</h2>
<div class="outline-text-2" id="text-org3047baa">
</div>
<div id="outline-container-orgcb65801" class="outline-3">
<h3 id="orgcb65801">The Daemon</h3>
<div class="outline-text-3" id="text-orgcb65801">
<p>
In <code>~/.config/systemd/user/emacs.service</code> you need to add a new service to run the Emacs daemon which should look like this
</p>
<blockquote>
<p>
[Unit]
Description=Emacs: the extensible, self-documenting text editor
</p>
<p>
[Service]
Type=forking
ExecStart=/usr/bin/emacs –daemon
ExecStop=/usr/bin/emacsclient –eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"
Environment="LC<sub>CTYPE</sub>=zh<sub>CN.UTF</sub>-8" "XMODIFIERS=@im=fcitx"
Restart=always
</p>
<p>
TimeoutStartSec=0
</p>
<p>
[Install]
WantedBy=default.target
</p>
</blockquote>
<p>
Then you launch it for the user
</p>
<div class="org-src-container">
<pre class="src src-sh">systemctl --user enable emacs.service
systemctl --user start emacs.service
<span style="color: #b2b2b2; font-style: italic;">#</span><span style="color: #b2b2b2; font-style: italic;">systemctl --user status emacs.service</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfc30415" class="outline-3">
<h3 id="orgfc30415">The Client</h3>
<div class="outline-text-3" id="text-orgfc30415">
<p>
In <code>~/.local/share/applications/</code>
You need to remove the Emacs entry (usually <code>emacs.desktop</code>) and replace it with <code>~/.local/share/applications/emacsclient.desktop</code>
</p>
<p>
Which will look like this
</p>
<blockquote>
<p>
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacsclient -c
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;Utility;
StartupWMClass=Emacs
</p>
</blockquote>
</div>
</div>
</div>
<div id="outline-container-org815a838" class="outline-2">
<h2 id="org815a838">Firefox</h2>
<div class="outline-text-2" id="text-org815a838">
<p>
To use the downloaded verison of Firefox you need to add it to the menus and stuff so you can set it as default browser more easy.
</p>
<p>
In <code>~/.local/share/applications/</code>
Add a <code>firefox.desktop</code> with:
</p>
<blockquote>
<p>
[Desktop Entry]
Type=Application
Exec=/home/geokon/bin/firefox/firefox %u
Icon=firefox
Name=Firefox
Categories=Internet;
Comment=Custom definition for Firefox
</p>
</blockquote>
</div>
</div>
<div id="outline-container-orgdcb90c1" class="outline-2">
<h2 id="orgdcb90c1">fcitx</h2>
<div class="outline-text-2" id="text-orgdcb90c1">
<p>
Once you install it and the frontend you need to run <code>im-config</code> and then select to configure <code>fcitx</code> (so click Yes when it suggests to click No and then you will see the option there). Then restart
</p>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: George Kontsevich</p>
<p class="date">Created: 2019-03-01 五 19:12</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>