瀏覽代碼

Better mysql reinstallation instructions

Bob Mottram 11 年之前
父節點
當前提交
2d81fa4ebb
共有 1 個檔案被更改,包括 45 行新增8 行删除
  1. 45
    8
      beaglebone.txt

+ 45
- 8
beaglebone.txt 查看文件

1254
 iptables -A INPUT -p tcp --destination-port 4000 -j DROP
1254
 iptables -A INPUT -p tcp --destination-port 4000 -j DROP
1255
 iptables -A INPUT -p tcp --destination-port 119 -j DROP
1255
 iptables -A INPUT -p tcp --destination-port 119 -j DROP
1256
 iptables -A INPUT -p tcp --destination-port 137 -j DROP
1256
 iptables -A INPUT -p tcp --destination-port 137 -j DROP
1257
-iptables -A INPUT -p tcp --destination-port 3306 -j DROP
1258
 iptables -A INPUT -p tcp --destination-port 4242 -j DROP
1257
 iptables -A INPUT -p tcp --destination-port 4242 -j DROP
1259
 iptables -A INPUT -p tcp --destination-port 9050 -j DROP
1258
 iptables -A INPUT -p tcp --destination-port 9050 -j DROP
1260
 iptables -A INPUT -p tcp --destination-port 3000 -j DROP
1259
 iptables -A INPUT -p tcp --destination-port 3000 -j DROP
3320
 
3319
 
3321
 #+BEGIN_SRC: bash
3320
 #+BEGIN_SRC: bash
3322
 tar -xzvf ircd-hybrid-8.1.17.tgz
3321
 tar -xzvf ircd-hybrid-8.1.17.tgz
3323
-cd ircd-hybrid-*
3322
+cd ircd-hybrid-8.1.17
3324
 ./configure --prefix=/usr/local/ircd --enable-openssl
3323
 ./configure --prefix=/usr/local/ircd --enable-openssl
3325
 make
3324
 make
3326
 make install
3325
 make install
3365
 Now create an init script.
3364
 Now create an init script.
3366
 
3365
 
3367
 #+BEGIN_SRC: bash
3366
 #+BEGIN_SRC: bash
3368
-adduser --disabled-login irc
3367
+adduser irc
3368
+#+END_SRC
3369
+
3370
+Make the password some long random string.
3371
+
3372
+#+BEGIN_SRC: bash
3369
 editor /usr/bin/runircd
3373
 editor /usr/bin/runircd
3370
 #+END_SRC
3374
 #+END_SRC
3371
 
3375
 
3374
 #+BEGIN_SRC: bash
3378
 #+BEGIN_SRC: bash
3375
 #!/bin/sh
3379
 #!/bin/sh
3376
 USERNAME=irc
3380
 USERNAME=irc
3377
-COMMAND="cd /usr/local/ircd; ircd > /usr/local/ircd/ircd.log"
3381
+COMMAND="cd /usr/local/ircd/bin; ircd > /usr/local/ircd/ircd.log"
3378
 su -l $USERNAME -c '$COMMAND'
3382
 su -l $USERNAME -c '$COMMAND'
3379
 #+END_SRC
3383
 #+END_SRC
3380
 
3384
 
7260
 To restore yesterday's friendica backup:
7264
 To restore yesterday's friendica backup:
7261
 
7265
 
7262
 #+BEGIN_SRC: bash
7266
 #+BEGIN_SRC: bash
7263
-mysql -D friendica -o < /var/backups/friendica_daily.sql
7267
+mysql -u root -p friendica -o < /var/backups/friendica_daily.sql
7264
 #+END_SRC
7268
 #+END_SRC
7265
 
7269
 
7266
 To restore yesterday's Red Matrix backup:
7270
 To restore yesterday's Red Matrix backup:
7267
 
7271
 
7268
 #+BEGIN_SRC: bash
7272
 #+BEGIN_SRC: bash
7269
-mysql -D redmatrix -o < /var/backups/redmatrix_daily.sql
7273
+mysql -u root -p redmatrix -o < /var/backups/redmatrix_daily.sql
7270
 #+END_SRC
7274
 #+END_SRC
7271
-*** Removing mysql server
7275
+*** Removing and reinstalling mysql server
7272
 
7276
 
7273
-If you manage to screw up sql server completely then it can be fully deleted with:
7277
+Sometimes the mysql database may get completely messed up, and running /service mysql start/ may always fail with nothing reported in the logs.  So if you manage to get into that unfortinate situation then you can fully remove mysql and reinstall it as follows:
7274
 
7278
 
7275
 #+BEGIN_SRC: bash
7279
 #+BEGIN_SRC: bash
7276
 ps aux | grep mysql
7280
 ps aux | grep mysql
7280
 
7284
 
7281
 #+BEGIN_SRC: bash
7285
 #+BEGIN_SRC: bash
7282
 apt-get remove --purge mysql\*
7286
 apt-get remove --purge mysql\*
7287
+rm -rf /etc/mysql
7288
+rm -rf /var/lib/mysql
7283
 apt-get clean
7289
 apt-get clean
7284
 updatedb
7290
 updatedb
7285
 #+END_SRC
7291
 #+END_SRC
7292
+
7293
+Reinstall mysql:
7294
+
7295
+#+BEGIN_SRC: bash
7296
+apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt php5-fpm php5-cgi php-apc
7297
+#+END_SRC
7298
+
7299
+Then to recreate the Friendica and webmail databases:
7300
+
7301
+#+BEGIN_SRC: bash
7302
+mysql -p
7303
+create database friendica;
7304
+CREATE USER 'friendicaadmin'@'localhost' IDENTIFIED BY 'myfriendicapassword';
7305
+GRANT ALL PRIVILEGES ON friendica.* TO 'friendicaadmin'@'localhost';
7306
+create database roundcubemail;
7307
+CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'roundcubepassword';
7308
+GRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';
7309
+quit
7310
+mysql -u root -p friendica -o < /var/backups/friendica_daily.sql
7311
+#+END_SRC
7312
+
7313
+And if you previously had Red Matrix installed:
7314
+
7315
+#+BEGIN_SRC: bash
7316
+mysql -p
7317
+create database redmatrix;
7318
+CREATE USER 'redmatrixadmin'@'localhost' IDENTIFIED BY 'myredmatrixpassword';
7319
+GRANT ALL PRIVILEGES ON redmatrix.* TO 'redmatrixadmin'@'localhost';
7320
+quit
7321
+mysql -u root -p redmatrix -o < /var/backups/redmatrix_daily.sql
7322
+#+END_SRC
7286
 ** Regenerating SSL certificates
7323
 ** Regenerating SSL certificates
7287
 If a security vulnerability arrises which requires you to regenerate your SSL certificates, such as [[http://filippo.io/Heartbleed]["heartbleed"]], then this can be done as follows:
7324
 If a security vulnerability arrises which requires you to regenerate your SSL certificates, such as [[http://filippo.io/Heartbleed]["heartbleed"]], then this can be done as follows:
7288
 
7325