Friday, January 12, 2018
Bootstrapping a VSTS Linux build agent for Docker containers
2. Install dotnetcore using the instructions here.
3. Install the Docker apt-get package using the instructions here.
4. Download and run the VSTS agent Docker image and run it as a Docker container itself using the instructions here, e.g. sudo docker run -e VSTS_ACCOUNT=myvstsaccountname -e VSTS_TOKEN=abcdtokenherefromportal -e VSTS_POOL="Docker Build Agents" -e VSTS_AGENT="myagentname" -it -v /var/run/docker.sock:/var/run/docker.sock microsoft/vsts-agent
Friday, March 21, 2014
Undefined reference to `log' when compiling on Ubuntu 13.10 with gcc
Add '-Wl,--no-as-needed' to your LDFLAGS
Thursday, January 02, 2014
Installing NTP on an Ubuntu server
Installing a TFTP server using xinetd on Ubuntu
- # apt-get install xinetd tftpd
- Ensure that the following lines are in the /etc/services file:
- tftp 69/tcp
- tftp 69/udp
- Open the /etc/xinetd.d/tftp file (create it if it doesn't exist) and ensure that it contains the following:
# default: off # description: The tftp server serves files using the Trivial File Transfer \ # Protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot disable = no } # /etc/init.d/xinetd restart
Test the server:# tftp localhosttftp> get hello.txt Received 23 bytes in 0.1 seconds tftp> quit
Friday, May 31, 2013
How to fix the ugly ass Ubuntu boot splash OR Damn, Ubuntu, you ugly
If you've had Ubuntu for a while and you've got an nVidia video card, chances are you've got the ugly ass default boot screen. Fortunately, you can fix this. You just need to follow the instructions above. I hope you're comfortable with the command line.
Monday, August 16, 2010
Running multiple Tomcat 6 instances in Ubuntu, the quick and dirty way
- Copy the /etc/init.d/tomcat script with a new name in the same directory
- Update the NAME variable in the startup script with a name for the new instance that you want to run.
- Copy /usr/share/$(old)NAME to the (new) NAME you've just created, along with /var/lib/$(old)NAME and /etc/default/$(old)NAME
- Edit the server.xml file under /var/lib/$(new)NAME/conf/ and change all the ports (ie for shutdown, and all your Connectors) so that they don't conflict with the old instance
- Run /etc/init.d/$(new tomcat script name) start
You should now have a running, fully functional instance of Tomcat on the server, using a different port.
Thursday, January 21, 2010
Setting up Tomcat (5.5) on Ubuntu Server 8.10
sudo apt-get install -y tomcat5.5 tomcat5.5-admin tomcat5.5-webapps
If you're copying configuration over from a previous Tomcat / Ubuntu installation, you need to make sure the permissions on all the files you copy are set correctly. In most cases, you'll have to run :
chown -R tomcat55:adm [file and folder list here]
If you're securing the applications with a certificate, try to make sure it's valid for your location and ensure that you've set it properly in your server.xml configuration file. If you want useful logging, you'll also have to place a log4j.properties file in
$CATALINA_HOME/common/classes
Hope this helps.
Tuesday, July 14, 2009
Keeping your servers up to date
sudo /etc/network/if-up.d/ntpdate
sudo ntpdate pool.ntp.org
Obviously, entering this command every day or every week gets tiresome and stupid, so you can get cron to schedule this daily for you by running the following commands :
echo "sudo ntpdate ntp.ubuntu.com" >> /etc/cron.daily/ntpdate
chmod 755 /etc/cron.daily/ntpdate
Wednesday, May 20, 2009
Some helpful troubleshooting tips for SFTP jails
Tuesday, January 06, 2009
Allowing external root access to your MySQL database
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ('myrootpassword');* EDIT * : The above statement does not necessarily copy all privileges over to the new entry for 'root'@'%' in the mysql.user table. A better way to accomplish full external root access is the following :
DELETE FROM `mysql`.`user` WHERE User = 'root' AND Host = '%';
INSERT INTO `mysql`.`user` (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections) (SELECT '%', User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv, Create_view_priv, Show_view_priv, Create_routine_priv, Alter_routine_priv, Create_user_priv, ssl_type, ssl_cipher, x509_issuer, x509_subject, max_questions, max_updates, max_connections, max_user_connections FROM `mysql`.`user` WHERE User = 'root' AND Host = 'localhost');
FLUSH PRIVILEGES;
Setting up MySQL server on Ubuntu
apt-get install -y mysql-server
Once that's done, you'll need to perform some additional configuration and setup the root password. My added configuration involves making table name comparisons all lower case (convenient for queries) and making the server run entirely in utf8. In order to configure the server as such, you'll need to make the following changes :
Add the following lines to the [mysqld] section of the my.cnf configuration :
default-character-set=utf8
default-collation=utf8_general_ci
lower_case_table_names=1
Add the following line to the [mysql] section of my.cnf (note that this is not the same as the [mysqld] section, the difference being the 'd' on the end) :
default-character-set=utf8
In order to have the Ubuntu MySQL installation properly run on external hosts, you'll have to comment out the line that looks like :
bind-address 127.0.0.1
After you've configured the my.cnf file, you'll have to stop the server, and restart it with --skip-grant-tables enabled so that you can have free, unfettered access to the system with privileges disabled. This is required so that you can set the initial root password. Run the following commands as root :
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables --skip-networking &
The latter command will start the MySQL server with privileges disabled.
Then log in with the command
mysql -u root -h localhost
Once logged in, run the command :
UPDATE `mysql`.`user` SET Password = PASSWORD('thepassword') WHERE User = 'root';
This will set the user password to 'thepassword' (though I recommend you don't use that exact password). Once you've set the root password, exit mysql and run the command
/etc/init.d/mysql restart
This will restart the server as usual, so that you'll no longer have unlimited privileges (and neither will anyone else).
Setting up an SSH Server on Ubuntu
apt-get install openssh-server
...as root. If you get an error to the effect of :
Package does not exist
...then you'll have to run :
apt-get update
...to update your system's packages first.
Saturday, August 16, 2008
A moment of developer clarity and zen
The really amazing part was just how much this sped things up : it took my project build time from 6 mins, 30 seconds down to 35 seconds. And those are real numbers (plus or minus a couple seconds, due to slight variations in repeated builds.)
Friday, July 11, 2008
Pure FTP on Ubuntu
Pure FTP is a great FTP server and I love it because it's ridiculously fast, reliable and works well for our company. The only problem is that it's tricky to configure on Ubuntu because just like with numerous other programs, the people at Ubuntu, in their infinite wisdom, felt the need to fuck with the program's default way of doing things. Specifically, in Ubuntu, command line arguments for starting the FTP service are done through individual files for each command line option you want the service to be started with, with values for the options placed inside each of the files. This is a stupid way of doing things, but that's not the topic of this post.
The problem I've been having lately is that I recently deployed new projects within our production network, and these new projects required access to the FTP server, and aren't on the same box as the server, as is the sole other project that has been using the FTP server. I'd been getting problems trying to connect to the server from any LAN box, but not any external boxes nor the machine itself (localhost). The error I got back was "421 Service not available". I googled around for hours and found nothing useful, until I started realizing that other people were getting 421 errors when their PureFTP instance was misconfigured, but with different messages, and then it got me thinking that maybe my instance was somehow misconfigured.
I re-read the documentation for PureFTP and after an hour or so, it hit me that the server does reverse lookups to resolve fully qualified names, and such resolution doesn't work properly on our network (for good reasons that I'm not going to go into). After disabling reverse DNS resolution with the -H startup option (`echo "yes" >> DontResolve` in the configuration directory in Ubuntu), the problem went away.
I hope this helps anybody else who runs into the same problem.
Monday, July 07, 2008
Tomcat quirks
The JAVA_HOME and JRE_HOME variables must be set. If they're not, then Tomcat won't start, at least on Ubuntu Gutsy Gibbon Server. This is a problem I encountered with the default installation of JIRA on one of our production servers.
When using EhCache with Hibernate, the tmp directories don't get deleted, regardless of whether or not Tomcat is shutdown properly. This will block the container from starting up again, so these temp files must be deleted. I encountered this problem with my own applications.
Tuesday, June 03, 2008
Fixing package retrieval quirks in Ubuntu Gutsy Gibbon Server
/etc/apt/sources.list, and you'll have to find a line similar to :
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted
Comment out this line, try your update again and you should be good to go.
Monday, March 31, 2008
Determining which version of Ubuntu you're running
cat /etc/issue
I learned of this little trick from here.
*Edit (2008-10-29)*
A much better command for determining the current Ubuntu version you're running :
lsb_release -a
Tuesday, February 26, 2008
Setting up your own domain in (Ubuntu) Linux
I'd love to be able to write a coherent guide based off of the information from these pages, but I'm just too busy at work to do it at the moment.