ubuntu 安装svn

环境:ubuntu10.04LTS

1、在终端中直接输入  sudo apt-get install subversion,选择安装即可
2、查看版本命令 svnserve –version(更多命令直接键入svnserve –help可查看到)
3、查看svnserver是否已启动: netstat -ntlp,可看到svn对应的端口3690(如果没有看见,则证明服务未启动,可使用svnserve -d启动svn服务,还可以通过svnserve -d -r /home/wwwwfw/mobile来指定启动目录)
4、建立项目:svnadmin create mobile(mobile为项目名称,位置在当前登录用户的主目录下,如我使用wwwwfw登录,则路径为/home/wwwwfw/mobile)
5、在mobile文件夹中可以看到conf文件夹,可针对conf文件夹中的authz、passwd、svnserve.conf进行设置,svnserve.conf主要设置整体的安全策略,passwd则设置用户名和密码,authz则是设置具体的用户有什么权限。
6、常用svn命令:
     checkout(co)命令:

      svn co url –username user –password password

               根据提示可以输入yes来保存帐号和密码;

       update(up)命令:

                进入到需要更新的目录,输入:svn up

      commit(ci)命令:

            进入需要提交的目录,输入:svn ci -m “修改信息”

    add命令:

         进入需要提交的目录,输入:svn add filename or path

       添加完之后需要用commit命令提交。

 

   另外,在vi中也可以不退出编辑的文件来提交文件,

    使用shell命令::! svn ci -m “commit information..”

 

ubuntu下SVN服务器安装配置

一、SVN安装

1.安装包
$ sudo apt-get install subversion

2.添加svn管理用户及subversion组
$ sudo adduser svnuser
$ sudo addgroup subversion
$ sudo addgroup svnuser subversion

 

3.创建项目目录
$ sudo mkdir /home/svn
$ cd /home/svn
$ sudo mkdir fitness
$ sudo chown -R root:subversion fitness
$ sudo chmod -R g+rws fitness

4.创建SVN文件仓库
$ sudo svnadmin create /home/svn/fitness

5.访问方式及项目导入:
$ svn co file:///home/svn/fitness
或者
$ svn co file://localhost/home/svn/fitness
* 注意:
如果您并不确定主机的名称,您必须使用三个斜杠(///),而如果您指定了主机的名称,则您必须使用两个斜杠(//).
//–
下面的命令用于将项目导入到SVN 文件仓库:
$ svn import -m “New import” /home/svn/fitness file:///home/svnuser/src/fitness
一定要注明导入信息

 

//————————–//
6.访问权限设置
修改 /home/svn/fitness目录下:
svnserve.conf 、passwd 、authz三个文件,行最前端不允许有空格
//–
编辑svnserve.conf文件,把如下两行取消注释
password-db = password
authz-db = authz 

//补充说明
# [general]
anon-access = read
auth-access = write
password-db = passwd
其中 anon-access 和 auth-access 分别为匿名和有权限用户的权限,默认给匿名用户只读的权限,但如果想拒绝匿

 

名用户的访问,只需把 read 改成 none 就能达到目的。

//–
编辑/home/svnuser/etc/passwd 如下:
[users]
mirze = 123456
test1 = 123456
test2 = 123456
//–
编辑/home/svnuser/etc/authz如下
[groups]
admin = mirze,test1
test = test2
[/]
@admin=rw
*=r
这里设置了三个用户mirze,test1,test2密码都是123456
其中mirze和test1属于admin组,有读和写的权限,test2属于test组只有读的权限

7.启动SVN服务
svnserve -d -r /home/svn
描述说明:
-d 表示svnserver以“守护”进程模式运行
-r 指定文件系统的根位置(版本库的根目录),这样客户端不用输入全路径,就可以访问版本库
如: svn://192.168.12.118/fitness

这时SVN安装就完成了.
局域网访问方式:
例如:svn checkout svn://192.168.12.118/fitness –username mirze –password 123456 /var/www/fitness

MySQL Engines: InnoDB vs. MyISAM – A Comparison of Pros and Cons

MySQL Engines: InnoDB vs. MyISAM – A Comparison of Pros and Cons

by Yang Yang on September 2, 2009

    The 2 major types of table storage engines for MySQL databases are InnoDB and MyISAM. To summarize the differences of features and performance,
  1. InnoDB is newer while MyISAM is older.
  2. InnoDB is more complex while MyISAM is simpler.
  3. InnoDB is more strict in data integrity while MyISAM is loose.
  4. InnoDB implements row-level lock for inserting and updating while MyISAM implements table-level lock.
  5. InnoDB has transactions while MyISAM does not.
  6. InnoDB has foreign keys and relationship contraints while MyISAM does not.
  7. InnoDB has better crash recovery while MyISAM is poor at recovering data integrity at system crashes.
  8. MyISAM has full-text search index while InnoDB has not.

In light of these differences, InnoDB and MyISAM have their unique advantages and disadvantages against each other. They each are more suitable in some scenarios than the other.

Advantages of InnoDB

  1. InnoDB should be used where data integrity comes a priority because it inherently takes care of them by the help of relationship constraints and transactions.
  2. Faster in write-intensive (inserts, updates) tables because it utilizes row-level locking and only hold up changes to the same row that’s being inserted or updated.

Disadvantages of InnoDB

  1. Because InnoDB has to take care of the different relationships between tables, database administrator and scheme creators have to take more time in designing the data models which are more complex than those of MyISAM.
  2. Consumes more system resources such as RAM. As a matter of fact, it is recommended by many that InnoDB engine be turned off if there’s no substantial need for it after installation of MySQL.
  3. No full-text indexing.

Advantages of MyISAM

  1. Simpler to design and create, thus better for beginners. No worries about the foreign relationships between tables.
  2. Faster than InnoDB on the whole as a result of the simpler structure thus much less costs of server resources.
  3. Full-text indexing.
  4. Especially good for read-intensive (select) tables.

Disadvantages of MyISAM

  1. No data integrity (e.g. relationship constraints) check, which then comes a responsibility and overhead of the database administrators and application developers.
  2. Doesn’t support transactions which is essential in critical data applications such as that of banking.
  3. Slower than InnoDB for tables that are frequently being inserted to or updated, because the entire table is locked for any insert or update.

The comparison is pretty straightforward. InnoDB is more suitable for data critical situations that require frequent inserts and updates. MyISAM, on the other hand, performs better with applications that don’t quite depend on the data integrity and mostly just select and display the data.

修改mysql的默认存储引擎

  1. 查看mysql存储引擎命令,在mysql>提示符下搞入
    show engines;

    字段 Support为:Default表示默认存储引擎  ,如下图:

  2. 设置InnoDB为默认引擎:在配置文件my.cnf中的 [mysqld] 下面加入default-storage-engine=INNODB 一句
    • Ubuntu系统下,my.cnf文件的路径为:/etc/mysql/my.cnf
  3. 重启mysql服务器:mysqladmin -u root -p shutdown或者service mysqld restart 登录mysql数据库

Linux下发现未授权登录用户怎么办

Linux下发现未授权登录用户怎么办

如果担心有非法用户闯入系统,最简单的办法就是用w命令来检查。

如果真的看到有非法用户在你的系统上,可以立即 kill 他的进程。

用vi /etc/passwd 命令把他的口令修改为“*”,或者把shell改为/sbin/nologin

先用w命令查看该用户tty号,然后用fuser -k tty号(或显示pts/*)就可以踢出了

即先用w命令查看在线用户,然后pkill -kill -t tty  如pkill -kill -t pts/1

MySql实现远程连接

1、进入mysql,创建一个新用户root,密码为root

   格式:grant 权限 on 数据库名.表名 to 用户@登录主机 identified by “用户密码”;


           grant select,update,insert,delete on *.* to root@192.168.1.12 identified by “root”;


   原先数据表结构

mysql> use mysql;

Database changed

mysql> select host,user,password from user;

+———–+——+——————————————-+
| host      | user | password                                  |
+———–+——+——————————————-+
| localhost | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+———–+——+——————————————-+

   执行上述语句后结果

mysql> use mysql;
Database changed
mysql> select host,user,password from user;
+————–+——+——————————————-+
| host         | user | password                                  |
+————–+——+——————————————-+
| localhost    | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 192.168.1.12 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+————–+——+——————————————-+
2 rows in set (0.00 sec)

 

   可以看到在user表中已有刚才创建的root用户。host字段表示登录的主机,其值可以用IP,也可用主机名,

   (1)有时想用本地IP登录,那么可以将以上的Host值改为自己的Ip即可。

2、实现远程连接(授权法)

   将host字段的值改为%就表示在任何客户端机器上能以root用户登录到mysql服务器,建议在开发时设为%。  
   update user set host = ’%’ where user = ’root’;

   将权限改为ALL PRIVILEGES

mysql> use mysql;
Database changed
mysql> grant all privileges  on *.* to root@’%’ identified by “root”;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,password from user;
+————–+——+——————————————-+
| host         | user | password                                  |
+————–+——+——————————————-+
| localhost    | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| 192.168.1.12 | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| %            | root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+————–+——+——————————————-+
3 rows in set (0.00 sec)

这样机器就可以以用户名root密码root远程访问该机器上的MySql.

3、实现远程连接(改表法)

use mysql;

update user set host = ‘%’ where user = ‘root’;

这样在远端就可以通过root用户访问Mysql.