Linux PDF
Linux PDF
LaTeX
sudo add-apt-repository ppa:texlive-backports/ppa
sudo apt-get update
sudo apt-get install texlive-full
Backoffice LCC
descargar fichero jnlp
javaws 39ce474e-59c1-4b84-9be2-2600c335b5c6.pro.jnlp &
AWS S3
copiar ficheros desde local a s3
~/.aws/credentials
[default]
aws_access_key_id = ...
aws_secret_access_key = ...
~/.aws/config
region=eu-west-1
instalar boto_rsync
python -m pip install --user boto_rsync
NPM
instalar npm con nvm (última versión) - no usar apt install npm
instalar nvm
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
nvm install node
npm -v
mkdir ~/.aws/
copiar fichero credentials a .aws
cd proyecto
npm install
npm run release ― para subir
copiar a ~/.gitconfig
[user]
name = Francisco Vico
email = [email protected]
username = fjvico
inicializar
cd repo
git init
git remote add origin https://[email protected]:fjvico/toolboxw.git
git remote set-url origin [email protected]:fjvico/toolboxw.git
hacer commit
cd repo
git add ---all
git commit -m $HOSTNAME
git push -u origin master
clonar
git clone [email protected]:fjvico/toolboxw.git
Question2Answer
https://devopsmates.com/install-question2answer-centos-7/
## 1. get Q2A
## http://docs.question2answer.org/install/
## 2. get unzip
$ yum install unzip .y
$ mkdir tmp
$ cd tmp
## 4. MySQL
## install mysql-server if not available
$ mysql -u root -p
(pw: GuadalineXmaria)
## create database
MariaDB [(none)]> CREATE DATABASE toolboxqa
## create user with privileges
MariaDB [(none)]> GRANT INSERT, SELECT, DELETE, UPDATE ON toolboxqa.* TO
'vico'@'localhost' IDENTIFIED BY '<1+>';
MariaDB [(none)]> quit
## 6
$ mv qa-config-example.php qa-config.php
## 7
$ nano qa-config.php
define('QA_MYSQL_HOSTNAME', 'localhost');
define('QA_MYSQL_USERNAME', 'vico');
define('QA_MYSQL_PASSWORD', '<1+>');
define('QA_MYSQL_DATABASE', 'toolboxqa');
$ mkdir /var/www/html/comunidad
## 8
$ cp -r question2answer-1.8.0/* /var/www/html/comunidad/
## 9
http://toolbox.uma.es/comunidad/
click
enter admin user data
administración:
http://toolbox.uma.es/comunidad/index.php/admin/general
servidor de correo
https://hostpresto.com/community/tutorials/how-to-setup-an-email-server-on-centos7/
CentOS 7 server
actualizar website
sftp [email protected]
sftp>put -r web/* /var/www/html/
scp -r ...
instalar certificado
yum install mod_ssl
nano /etc/httpd/conf.d/ssl.conf
modificar:
# Server Certificate:
# Server Private Key:
# Server Certificate Chain:
quitar SELinux
nano /etc/sysconfig/selinux
SELINUX=disabled
sestatus
FTP server
https://www.thegeekdiary.com/centos-rhel-how-to-configure-iptable-rules-to-all
ow-ftp-ports-2021/
$nano /etc/sysconfig/iptables-config
IPTABLES_MODULES="ip_conntrack_ftp"
2. Edit file /etc/sysconfig/iptables and make sure iptables rules are added
for port 20/21
$ nano /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Note: Order of the iptables rules is important.
3. Restart iptables service
## status
$ iptables -nvL
TELNET server
https://www.unixmen.com/installing-telnet-centosrhelscientific-linux-6-7/
$ nano /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 23 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# passwd -l root
# passwd -u root
medidas de seguridad
nano /etc/ssh/sshd_config
PubkeyAuthentication yes
AuthorizedKeyFile .ssh/authorized_keys
PasswordAuthentication no
ChallengeResponseAuthentication no
fail2ban
## activar fail2ban tras booting
systemctl enable fail2ban
## activar fail2ban
systemctl start fail2ban
## desactivar fail2ban
systemctl stop fail2ban
nano /etc/fail2ban/jail.local
## reiniciar tras cambiar configuración
systemctl restart fail2ban
firewalld
## activar firewall tras booting
systemctl enable firewalld
## activar firewall
systemctl start firewalld
## desactivar firewall
systemctl stop firewalld
servicios de firewalld
## activar la zona que permite acceso de las páginas web a través del firewall
firewall-cmd --zone=public --add-service=http
## para activarlo tras booting
firewall-cmd --zone=public --permanent --add-service=http
## sudo firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --zone=public --permanent --add-port=8080/tcp
## sudo firewall-cmd --zone=public --permanent --add-service=https
nano /etc/fail2ban/jail.d/sshd.local
## reiniciar tras cambiar configuración
systemctl restart firewalld
stress test
ssh-add ~/.ssh/toolbox
ssh [email protected]....
==============================
mkdir .ssh
chmod 700 .ssh
iptraf
monitorix
setup
refresh_rate = 60
<auth>
enabled = y
msg = ToolboX use statistics
htpasswd = /var/lib/monitorix/htpasswd
cop
Install toolbox in centos
MV
geb.uma.es 150.214.45.158
ipi.geb.uma.es 150.214.45.146
toolbox.uma.es 150.214.45.146
configuración
~/.hgrc
[ui]
username=Francisco Vico <[email protected]>
ssh = ssh -C
[auth]
repo.prefix = https://bitbucket.org/umafoss/
repo.username = fjvico
opt/toolbox/.hg/hgrc
# example repository config (see "hg help config" for more info)
[paths]
default = https://[email protected]/umafoss/toolbox
[ui]
# name and email (local to this repository, optional), e.g.
# username = Jane Doe <[email protected]>
temperature sensors
sudo apt-get install lm-sensors
sudo sensors-detect
[sudo service kmod start]
sensors
install tor
sudo add-apt-repository ppa:webupd8team/tor-browser
sudo apt-get update
sudo apt install tor-browser
lcc backoffice
http://www.lcc.uma.es/backoffice
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
sudo add-apt-repository ppa:webupd8team/java
sudo apt update; sudo apt install oracle-java8-installer
javac -version
sudo apt install oracle-java8-set-default
http://askubuntu.com/questions/16446/how-to-get-my-software-into-ubuntu
CRON
VER ACTIVIDAD DE CRON
## CentOS 7
more /var/log/cron | tail -2
## Lubuntu
grep -i cron /var/log/syslog | tail -2
EDITAR CRONTAB
## usuario actual
crontab -e
## general del sistema (peligroso)
nano /etc/crontab
SHELL=/bin/bash
crontab en toolbox.uma.es
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
iniciar
Esc
F9 -> boot options
UEFI - Kingston Data Traveler u otro nombre de fabricante
aparece menú blanco y negro > install Lubuntu
vico
folio (casa) / folio2 (despacho)
[Desktop Entry]
Type=Application
Exec=<command to execute>
mv ~/.config/openbox ~/.config/openbox.back
clonar .config/ openbox fjvico fjvico
openbox --reconfigure
no usar:
Legacy - (Kingston Data Traveler u otro nombre de fabricante)
aparece menú azul > Install Lubuntu
dr
usb speakers
sudo apt install pavucontrol
>> built-in audio off
slim / next
sudo dd bs=4M if=guadalinexedu-nextslim-instalador-centros-2016122201.iso of=/dev/sdb
status=progress && sync
guadalinex 2013
sudo dd bs=4M if=guadalinexedu-2013-instalador-centros.iso of=/dev/sdb status=progress && sync
espeak
sudo apt-get install espeak mbrola mbrola-es1 mbrola-es2
>> /etc/rc.local ?
particionar pendrive
formatear pendrive
sudo gparted
create partition table
create primary partition
format as ms-dos
impresoras LCC
## install CUPS
sudo apt-get update
sudo apt-get install cups
sudo /etc/init.d/cups restart
lubuntu
Mac Mini
Instalación: insertar pen de instalación y mantener presionada la tecla Alt para entrar en setup cuando
aparece la pantalla blanca; seleccionar EFI Boot y después “Instalar Lubuntu”.
Para evitar la pantalla negra y el error: con las flechas situarse sobre instalar lubuntu y presionar ‘e’ para
editar parámetros de boot, añadir ‘nomodeset’ al final de la línea larga (antes de “---”) y presionar F10
para boot.
digital clock: %a %d %b %R = Fri 16 Jul 15:22
printer
1
architecture of the system / Linux version
lscpu
uname -i
uname -a # long version
have more workspaces
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ vsize 3
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize 3
mlterm as default terminal
sudo update-alternatives --config x-terminal-emulator
brillo y color de pantalla (dimmer)
instalar redshift
dimmer.sh
#!/bin/bash
if [ $# -eq 0 ]; then
redshift -o -l 40.41:-3.69 > /dev/null
exit
fi
if [ $# -eq 1 ]; then
TEMPERATURE=100
else
TEMPERATURE=$2
fi
MAXTEMP=6500
MINTEMP=3700
/boot
● Extended Partition
○ 10Gb (10240Mb) - swap
(0.5% is not much, and 10Gb is double the memory size of typical 4Gb system)
swap
○ 30Gb (30960Mb) - root /
(for Ubuntu system files and applications)
/
○ 100Gb (102400Mb) - /home
(system/application dependent config, data and other files)
/home
● 1850Gb free for another operating system, your system-independent media files, virtual machines and stuff
In case you can't get your device formatted from Method #1 try this way.
4.
5. Erase everything in the pen drive (OPTIONAL):
6. sudo dd if=/dev/zero of=/dev/sdb bs=4k && sync
7. Replace /dev/sdb with your corresponding device. This will take some time. It will pretend to
stuck. Just be patient.
8. Make a new partition table in the device:
9. sudo fdisk /dev/sdb
○ Then press letter o to create a new empty DOS partition table.
10. Make a new partition:
○ Press letter n to add a new partition. You will be prompted for the size of the
partition. Making a primary partition when prompted, if you are not sure.
○ Then press letter w to write table to disk and exit.
11. Format your new partition.
○ See what is your new partition with a command lsblk
○ In my case it is /dev/sdb1
12.
○ Issue the command below to format the new volume:
○ sudo mkfs.vfat /dev/sdb1
○ Please replace /dev/sdb1 with your corresponding device.
○ Eject the device:
○ sudo eject /dev/sdb
ejecutar
sudo /usr/bin/unetbootin
_____
make bootable USB of ubuntu from Linux
Chrome
http://askubuntu.com/a/79284
update chrome
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable
sudo pkill -15 google-chrome
sudo pkill -15 chrome
Launcher
suspend (14.04)
Hibernate
sudo -i
cd /var/lib/polkit-1/localauthority/50-local.d/
gedit com.ubuntu.enable-hibernate.pkla
Copy and paste below lines into the file and save it.
Java
Octave
copy JSONLAB
addpath /usr/share/octave/<version>/m/jsonlab
savepath
Speed test
chmod +x speedtest-cli
./speedtest-cli
Pendiente
activar workspaces
Mercurial
cd /path/of/repository
hg init
hg add -X **~
hg status
hg commit --addremove -m "first upload" -u fjvico
... # create repository in bitbucket
hg push https://fjvico:[email protected]/fjvico/toolbox # update cloud clone
...
hg pull -u https://fjvico:[email protected]/fjvico/toolbox # update local clone
subir
echo "hg add -R ~/opt/toolbox -S -X **~" > ~/.local/bin/subir
echo "hg commit --addremove -R ~/opt/toolbox -S -m hpcasa -u fjvico" >>
~/.local/bin/subir
echo "hg push -R ~/opt/toolbox https://[email protected]/fjvico/toolbox" >>
~/.local/bin/subir
chmod +x ~/.local/bin/subir
bajar
echo "hg pull -u -R ~/opt/toolbox https://[email protected]/fjvico/toolbox" >
~/.local/bin/bajar
chmod +x ~/.local/bin/bajar
Download videos: youtube-dl
COMPARTIR WIFI
http://ubuntuhandbook.org/index.php/2014/09/3-ways-create-wifi-hotspot-ubuntu/
Añadir Julia a Geany
How to add limited Julia highlight: Linux
SEE: geany custom-filetypes
#434 thread by @getzze
https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc
https://github.com/JuliaLang/IJulia.jl/blob/master/deps/julia.js
https://github.com/JuliaLang/julia/blob/71c0aa3e5660258af5c042058d5d8d3b82d93efb/contrib/julia.h
rc
keywords from pygment lexer (http://pygments.org/)
Add a Julia filetypes.Julia.conf
create a file: filetypes.Julia.conf in /usr/share/geany/filetypes.Julia.conf in to the users geany config
folder
To get the User config dir:
Geany > Help > Debug Messages: User config dir: e.g. /home/username/.config/geany
Copy the text into it / adjust if needed
# filetypes.Julia.conf
#
# For complete documentation of this file, please see Geany's main documentation
# based on
# https://groups.google.com/forum/#!topic/julia-users/tisM_9sKPCc
# https://github.com/geany/geany/issues/434
# https://github.com/JuliaLang/IJulia.jl/blob/master/deps/julia.js
#
https://github.com/JuliaLang/julia/blob/71c0aa3e5660258af5c042058d5d8d3b82d93efb/contrib/julia.h
rc
# keywords from pygment lexer (http://pygments.org/)
#
# Very limited support for julia based on the Matlab filetypes.matlab: 20150317 peter1000
[styling=Matlab/Octave]
[keywords]
# all items must be in one line
# keywords from pygment lexer (http://pygments.org/)
primary=abstract baremodule begin bitstype break catch ccall const continue do else elseif end export
finally for function global if immutable import importall in let local macro module quote return try type
typealias using while
#secondary=exit whos edit load is isa isequal typeof tuple ntuple uid hash finalizer convert promote
subtype typemin typemax realmin realmax sizeof eps promote_type method_exists applicable invoke
dlopen dlsym system error throw assert new Inf Nan pi im
#identifiers=Bool Int Int8 Int16 Int32 Int64 Uint Uint8 Uint16 Uint32 Uint64 Float32 Float64 Complex64
Complex128 Any Nothing None
[settings]
# use builtin lexer for Matlab
lexer_filetype=Matlab/Octave
tag_parser=Matlab
# default extension used when saving files
extension=jl
# single comments, like # in this file
comment_single=#
# multiline comments
#comment_open=#=
#comment_close==#
[indentation]
width=4
# 0 is spaces, 1 is tabs, 2 is tab & spaces
type=0
[build_settings]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
compiler=
run_cmd=julia "%f"
Add Julia to: filetype_extensions.conf (/home/username/.config/geany/filetype_extensions.conf)
Geany > Tools > Configuration Files > filetype_extensions.conf
add a line:
Julia=*.jl;
add Julia to the [Groups]
Programming=Julia;Clojure;CUDA;Cython;Genie;Go;Rust;Scala;
Toolbox live
Octave
sudo apt-add-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave
editor
sudo apt-get install gedit (tarda bastante)
geany
eliminar menu bar en geany: en libmain.c, mirar main_init(void)
o activar global menu
jsonlab
sudo cp -a /path/to/jsonlab /usr/share/octave/<version>/m
addpath /usr/share/octave/4.0.2/m/jsonlab
savepath
autorun
crear un fichero .desktop en ~/.config/autostart (crear este directorio si no existe)
[Desktop Entry]
Type=Application
Exec=ToolboX.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Startup Script
cd /usr/local/bin
sudo ToolboX.sh
sudo chmod +x Toolbox.sh
sudo gedit ToolboX.sh
copiar en gedit
#!/bin/bash
setxkbmap -layout es
xmodmap -e “keycode 67 =” #desactivar F1
xmodmap -e “keycode 68 =” #desactivar F2
xmodmap -e “keycode 69 =” #desactivar F3
xmodmap -e “keycode 70 =” #desactivar F4
xmodmap -e “keycode 71 =” #desactivar F5
xmodmap -e “keycode 72 =” #desactivar F6
xmodmap -e “keycode 73 =” #desactivar F7
xmodmap -e “keycode 74 =” #desactivar F8
xmodmap -e “keycode 75 =” #desactivar F9
xmodmap -e “keycode 76 =” #desactivar F10
xmodmap -e “keycode 95 =” #desactivar F11
xmodmap -e “keycode 96 =” #desactivar F12
xmodmap -e “keycode 171 =” #desactivar Fn+F12
xmodmap -e “keycode 133 =” #desactivar tecla Windows
xmodmap -e “keycode 134 =” #desactivar tecla Fn-Windows
xmodmap -e “keycode 37 =” #desactivar tecla Control izq
xmodmap -e “keycode 105 =” #desactivar tecla Control der
xmodmap -e “keycode 64 =” #desactivar tecla Alt
xmodmap -e “keycode 108 =” #desactivar tecla Alt-Gr
…
lxterminal --working-directory=”/home/lubuntu/Documents/ToolboX”
--command=”/home/lubuntu/Documents/ToolboX/ToolboX.m maths_4ESO”
exit
eliminar cabecera de ventanas
~/.config/openbox/lubuntu-rc.xml
include in the <applications> section:
<applications>
<application class="*">
<decor>no</decor>
</application>
...
ventanas en laterales
~/.config/openbox/lubuntu-rc.xml
include in the <applications> section:
<!-- Allocate 'lxterminal' in the left half-->
<application name="lxterminal">
<position>
<x>0</x>
<y>0</y>
</position>
<maximized>Vertical</maximized>
</application>
<!-- Allocate 'gedit' in the right half-->
<application name="gedit">
<position>
<x>-0</x>
<y>0</y>
</position>
<maximized>Vertical</maximized>
</application>
1 desktop
<desktops>
...
<number>1</number>
…
<name>ToolboX</name>
</desktops>
remove taskbar
~/.config/lxpanel/Lubuntu/panels/panel
At the very top of the file, in the General section, you can modify these parameters
autohide=1
heightwhenhidden=0
terminar sesión
gnome-session-quit # logout
shutdown ‘now’
bloquear teclas
xmodmap -e “keycode <dec_num> = ”
F1 67
…
F10 76
F11 95
F12 96
xmodmap
keysyms recognized by Tk
touchpad: synclient
synclient TouchPadOff=1
teclas - identificar keycode
xev
cómo identificar una ventana
screen coordinates
man X
GEOMETRY SPECIFICATIONS
One of the advantages of using window systems instead of hardwired terminals is that applications
don't have to
be restricted to a particular size or ___location on the screen. Although the layout of windows on a
display is
controlled by the window manager that the user is running (described below), most X programs
accept a command
line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
and YOFF are numbers)
for specifying a preferred size and ___location for this application's main window.
The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or
characters,
depending on the application. The XOFF and YOFF parts are measured in pixels and are used to
specify the dis-
tance of the window from the left or right and top and bottom edges of the screen, respectively.
Both types of
offsets are measured from the indicated edge of the screen to the corresponding edge of the window.
The X off-
set may be specified in the following ways:
+XOFF The left edge of the window is to be placed XOFF pixels in from the left edge of the screen
(i.e., the
X coordinate of the window's origin will be XOFF). XOFF may be negative, in which case the
window's
left edge will be off the screen.
-XOFF The right edge of the window is to be placed XOFF pixels in from the right edge of the
screen. XOFF
may be negative, in which case the window's right edge will be off the screen.
+YOFF The top edge of the window is to be YOFF pixels below the top edge of the screen (i.e., the
Y coordi-
nate of the window's origin will be YOFF). YOFF may be negative, in which case the window's
top edge
will be off the screen.
-YOFF The bottom edge of the window is to be YOFF pixels above the bottom edge of the screen.
YOFF may be
negative, in which case the window's bottom edge will be off the screen.
Offsets must be given as pairs; in other words, in order to specify either XOFF or YOFF both must be
present.
Windows can be placed in the four corners of the screen using the following specifications:
In the following examples, a terminal emulator is placed in roughly the center of the screen and a
load average
monitor, mailbox, and clock are placed in the upper right hand corner:
$ curl -sL
https://raw.githubusercontent.com/aniketpanjwani/chomper_installers/master/debian.sh
| bash && source ~/.bashrc