1,安装apache2
sudo apt-get install apache2
修改webroot
vim /etc/apache2/apache2.conf #在其中复制最后一个 <Directory>...</Directory>的内容,粘贴,并且把其最终的地址更改为自己的webroot vim /etc/apache2/sites-available/000-default.conf #把其中的DocumentRoot改为刚刚填写的webroot
重启apache2
sudo service apache2 restart sudo /etc/init.d/apache2 restart
2,安装mysql
sudo apt-get install mysql-server
我的版本安装完成以后mysql默认是用sudo启动的,密码是‘’,如何让mysql不用sudo也能启动而且用密码来识别呢?
sudo mysql -u root -p //进入以后 use mysql; // 下面这句命令有点长,请注意。 update mysql.user set authentication_string=password('密码') where user='root' and Host ='localhost'; update user set plugin="mysql_native_password"; flush privileges; quit;
3,安装php
目前开发板上只有php7能安装,php5已经没有了,各种方法安装php5均以失败告终,所以最终只能升级代码,使用php7,暴力升级php版本是真的烦
sudo apt-get install php sudo apt-get install php-mysql sudo apt-get install php-curl
重启apache应该就可以在webroot中打开php文件了,
其他相关的配置也写在本博客中:
4,如何向mysql中导入或者导出数据?
create database 数据库名称; mysql -h localhost -u root -p yourdatabase < ./hehe.sql #这是从sql文件中,向数据库yourdatabase导入数据 mysqldump -h localhost -u root -p yourdatabase > ./test.sql #从yourdatabase中导出数据并且保存为test.sql
5,经常向另一台ubuntu系统的设备传输数据,如何免密传输?
首先,本机上应该有ssh服务,没有的话安装一个
sudo apt-get install openssh-server
需要两台ubunut设备:
my computer:211
aim computer:129
ssh-keygen -t rsa #on my computer,然后会提示输入密码认证啥的,不用管,直接摁enter,然后会生成俩文件 ~/.ssh,其中一个是: id_rsa ,另一个是:id_rsa.pub,我们需要把把id_rsa.pub传输到aim computer上 scp ./id_rsa.pub pi@192.168.3.129:~/.ssh #此时还是需要密码的,然后要登上aim computer修改一下刚刚传过来的文件的名称 mv id_rsa.pub authorized_keys #有可能要加sudo,记不清了,传过来之前修改倒是也可以,完成以后,my computer向aim computerscp数据就不需要密码了
6,设置chromium-browser全屏启动
cd /home/pi/.config/chromium/Default/ chmod 444 Preferences #设置权限 chattr -i Preferences #忽略所有对该文件权限之类的更改,按我的理解嘛,就是异常退出以后下一次再启动chromium的时候不提醒是否恢复上次界面,取消的设置是这样的,chattr -i /home/username/.config/chromium/Default/Preferences,其实就是再执行一次chattr -i Preferences cd ~/.config/lxsession/LXDE-pi sudo vim autostart #添加一句话,注意,没有引号,也没有后台运行符 chromium-browser --start-fullscreen http://www.baidu.com
为什么不能加到/etc/rc.local中呢?因为rc.local是整个机器的启动文件,据说默认是sudo运行命令的,而chromium不能sudo运行,个人猜测那时候有些程序还没有启动或者加载,所以除了chromium还有其他程序也不能这样启动
扫描二维码关注公众号,回复:
7078846 查看本文章