-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinuxTools.txt
315 lines (258 loc) · 9.17 KB
/
linuxTools.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
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
Ubuntu 18.04 LTS install hardware requirements:
- 2gz dual core processor
- 2 GB mem
- 25 GB hard drive
- DVD/USB
- internet
diff -r dir1 dir2 > out.txt
apt list --installed
To install ssh:
sudo apt update
sudo apt-get install openssh-server
service sshd start
ssh-keygen
ssh-copy-id 127.0.0.1
ssh 127.0.0.1
To install Ansible:
$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible
To run a *.yml file:
ansible-playbook -K playbook.yml --list-hosts
cd /etc/ansible
sudo vi ansible.cfg
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
sudo apt install virtualbox-guest-x11-hwe
VBoxClient --clipboard
To add myself to vboxsf:
edit /etc/group
vboxsf:x:120:harriettxing
sudo adduser $USER vboxsf
# need restart
To install mysql:
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
sudo mysql
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
mysql> exit
mysql -u root -p
To remove mysql:
sudo apt-get purge mysql-apt-config
sudo apt-get remove mysql-apt-config
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
Or
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
To enable InnoDB encryption:
cd /etc/mysql/conf.d
sudo vi mysql.conf
add:
[mysqld]
plugin_dir=/usr/lib/mysql/plugin/
early-plugin-load=keyring_file.so
sudo /etc/init.d/mysql restart
To make table name case insensitive:
update /etc/mysql/mysql.cnf
[mysqld]
lower_case_table_names = 1
sudo /etc/init.d/mysql restart
To reset root password:
sudo /etc/init.d/mysql stop
sudo mkdir /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo mysqld_safe --skip-grant-tables &
mysql -uroot
use mysql;
update user set authentication_string=PASSWORD("Krunch-Moad-34") where User='root';
flush privileges;
quit;
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
mysql -u root -p
To install NGINX:
sudo apt-get update
sudo apt-get install nginx
sudo service nginx stop
sudo service nginx start
sudo service nginx restart
sudo update-rc.d nginx defaults
gunzip --keep httpd-2.4.33.tar.gz
tar -C apache -zxvf httpd-2.4.33.tar.gz
To install apach httpd server:
sudo apt-get update
sudo apt install net-tools
sudo apt-get install apache2
sudo apache2ctl configtest
netstat -an | more
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 restart
sudo systemctl restart apache2
sudo nano index.html
for Ubuntu 18.04 LTS
sudo vi /etc/apache2/sites-available/000-default.conf
default apache document root: /var/www/html
To add apache to vboxsf:
sudo usermod -a -G vboxsf www-data
To setup https on apache:
# dev.glc-md.com is the hostname
openssl req –new –newkey rsa:2048 –nodes –keyout dev.glc-md.com.key –out dev.glc-md.com.csr
# VirtualBoxUbuntu is the host name
openssl req –new –newkey rsa:2048 –nodes –keyout VirtualBoxUbuntu.key –out VirtualBoxUbuntu.csr
To install php 7.1:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
# sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-mcrypt php7.1-cli php7.1-xml php7.1-zip php7.1-mysql php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc
sudo apt-get install php7.1-mbstring
sudo nano /etc/php/7.1/apache2/php.ini
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
lookup Apache2 /etc/apache2/mods-available/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
sudo systemctl restart apache2.service
sudo nano /var/www/html/phpinfo.php
To install and configure php 7 with NGINX:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install software-properties-common
#sudo apt-get install python-software-properties
sudo apt-get update
# sudo apt-get -y install unzip zip nginx php7.2 php7.2-mysql php7.2-fpm php7.2-mbstring php7.2-xml php7.2-curl
sudo apt-get -y install unzip zip php7.2 php7.2-mysql php7.2-fpm php7.2-mbstring php7.2-xml php7.2-curl
cd /etc/nginx/sites-availablels
sudo vi default
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
include /etc/nginx/fastcgi.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
sudo systemctl restart php7.2-fpm
sudo systemctl restart nginx
To install Composer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar
sudo apt install composer
To install Laravel:
add $HOME/.config/composer/vendor/bin to $PATH
laravel new blog
To install python:
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
$ sudo apt-get install python-pip python-dev build-essential
$ sudo pip install --upgrade pip
$ sudo pip install --upgrade virtualenv
To install git:
sudo apt -y install git
git --version
sudo apt -y install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
navigate to https://github.com/git/git/tree/master
Click on "Branch:Master" -> tags -> the latest none rc version
-> Clone or download -> Download Zip -> Copy link address
wget https://github.com/git/git/archive/v2.18.0.zip
unzip v2.18.0.zip
cd git-2.18.0
make prefix=/usr/local all
sudo make prefix=/usr/local install
git --version
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"
To install Atom:
sudo add-apt-repository ppa:webupd8team/atom
sudo apt-get update
sudo apt-get install atom
To install wordpress:
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
To install curl:
sudo apt install curl
To install Node.js:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
node -v
sudo npm install npm --global
To install MongoDB:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
more /var/log/mongodb/mongod.log | grep 'waiting for connections on port 27017'
mongo --host 127.0.0.1:27017
To install NodeJS MongoDB driver:
sudo npm install mongodb
To install Java:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install default-jdk
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java10-installer
sudo apt install oracle-java10-set-default
java -version
For Oracle Java 10, see a different PPA: https://www.linuxuprising.com/2018/04/install-oracle-java-10-in-ubuntu-or.html
More info: https://launchpad.net/~webupd8team/+archive/ubuntu/java
To search for a string in textfiles:
sudo apt-get install searchmonkey
To copy all contents of a directory to another:
cp -a /source/. /dest/
Useful commands:
sudo apt install net-tools
uname -a
ifconfig
ip addr show
ip addr show DeviceName
/dev/sda1 26G 8.0G 16G 34% /
service udev status
service udev start
service udev stop
systemctl status udev
du -sh home
netstat -tulpn
ps aux | grep udev
top
htop ???
ls /mnt
mount /dev/sda2 /mnt
mount
less /etc/fstab
man <command>
List all directories:
ls -d */
grep -rnw . -e 'test string'
history
free -m